Fixed yet another FluentPDO fuckup

This commit is contained in:
Marcin Kurczewski 2014-10-03 21:10:13 +02:00
parent 614111a5f0
commit 8743cda1a0

View file

@ -189,6 +189,9 @@ abstract class AbstractDao implements ICrudDao
{ {
$sql = $sqlColumn; $sql = $sqlColumn;
$bindings = [$value->getValues()]; $bindings = [$value->getValues()];
if ($requirement->isNegated())
$sql = 'NOT ' . $sql;
} }
else if ($value instanceof \Szurubooru\SearchServices\Requirements\RequirementRangedValue) else if ($value instanceof \Szurubooru\SearchServices\Requirements\RequirementRangedValue)
@ -210,19 +213,23 @@ abstract class AbstractDao implements ICrudDao
} }
else else
throw new \RuntimeException('Neither min or max value was supplied'); throw new \RuntimeException('Neither min or max value was supplied');
if ($requirement->isNegated())
$sql = 'NOT (' . $sql . ')';
} }
else if ($value instanceof \Szurubooru\SearchServices\Requirements\RequirementSingleValue) else if ($value instanceof \Szurubooru\SearchServices\Requirements\RequirementSingleValue)
{ {
$sql = $sqlColumn; $sql = $sqlColumn;
$bindings = [$value->getValue()]; $bindings = [$value->getValue()];
if ($requirement->isNegated())
$sql = 'NOT ' . $sql;
} }
else else
throw new \Exception('Bad value: ' . get_class($value)); throw new \Exception('Bad value: ' . get_class($value));
if ($requirement->isNegated())
$sql = 'NOT (' . $sql . ')';
call_user_func_array([$query, 'where'], array_merge([$sql], $bindings)); call_user_func_array([$query, 'where'], array_merge([$sql], $bindings));
} }