From 8743cda1a028ad9651e45e6f5bde1920934f0489 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Fri, 3 Oct 2014 21:10:13 +0200 Subject: [PATCH] Fixed yet another FluentPDO fuckup --- src/Dao/AbstractDao.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Dao/AbstractDao.php b/src/Dao/AbstractDao.php index 301624bf..a6d6fa47 100644 --- a/src/Dao/AbstractDao.php +++ b/src/Dao/AbstractDao.php @@ -189,6 +189,9 @@ abstract class AbstractDao implements ICrudDao { $sql = $sqlColumn; $bindings = [$value->getValues()]; + + if ($requirement->isNegated()) + $sql = 'NOT ' . $sql; } else if ($value instanceof \Szurubooru\SearchServices\Requirements\RequirementRangedValue) @@ -210,19 +213,23 @@ abstract class AbstractDao implements ICrudDao } else throw new \RuntimeException('Neither min or max value was supplied'); + + if ($requirement->isNegated()) + $sql = 'NOT (' . $sql . ')'; } else if ($value instanceof \Szurubooru\SearchServices\Requirements\RequirementSingleValue) { $sql = $sqlColumn; $bindings = [$value->getValue()]; + + if ($requirement->isNegated()) + $sql = 'NOT ' . $sql; } else throw new \Exception('Bad value: ' . get_class($value)); - if ($requirement->isNegated()) - $sql = 'NOT (' . $sql . ')'; call_user_func_array([$query, 'where'], array_merge([$sql], $bindings)); }