Fixed bad SQL when looking for multiple uploaders
This commit is contained in:
parent
b7e2c28780
commit
4489277df8
1 changed files with 10 additions and 1 deletions
|
@ -166,7 +166,16 @@ class PostDao extends AbstractDao implements ICrudDao
|
|||
|
||||
elseif ($requirement->getType() === PostFilter::REQUIREMENT_UPLOADER)
|
||||
{
|
||||
$query->innerJoin('users uploader', 'uploader.id = posts.userId');
|
||||
foreach ($requirement->getValue()->getValues() as $userName)
|
||||
{
|
||||
$alias = 'u' . uniqid();
|
||||
$query->innerJoin('users ' . $alias, $alias . '.id = posts.userId');
|
||||
$sql = $alias . '.name = ?';
|
||||
if ($requirement->isNegated())
|
||||
$sql = 'NOT ' . $sql;
|
||||
$query->where($sql, [$userName]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
elseif ($requirement->getType() === PostFilter::REQUIREMENT_USER_SCORE)
|
||||
|
|
Loading…
Reference in a new issue