diff --git a/CHANGELOG.md b/CHANGELOG.md index 66d3445..aa7a676 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ Change Log ========== +### 07/06/2018 - 1.0.17 +* Fixed #19 the `AND` query logic. (previously the `where()` query would only used the last one in the chain). + ### 05/28/2018 - 1.0.16 * Fixed the scope resolution operator `::` for php 5.6 which throws the `T_PAAMAYIM_NEKUDOTAYIM` exception error. diff --git a/LICENSE b/LICENSE index a27506d..def1fd9 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017 Timothy Marois +Copyright (c) 2018 Timothy Marois Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Database.php b/src/Database.php index 04c83b3..1f3a5c9 100644 --- a/src/Database.php +++ b/src/Database.php @@ -10,7 +10,7 @@ class Database * Stores the version of Filebase * use $db->getVersion() */ - const VERSION = '1.0.16'; + const VERSION = '1.0.17'; //-------------------------------------------------------------------- diff --git a/src/QueryLogic.php b/src/QueryLogic.php index 11cb27f..f89889b 100644 --- a/src/QueryLogic.php +++ b/src/QueryLogic.php @@ -141,7 +141,7 @@ protected function filter($documents, $predicates) { list($field, $operator, $value) = $predicate; - $documents = array_values(array_filter($org_docs, function ($document) use ($field, $operator, $value) { + $documents = array_values(array_filter($documents, function ($document) use ($field, $operator, $value) { return $this->match($document, $field, $operator, $value); })); diff --git a/tests/QueryTest.php b/tests/QueryTest.php index 2a3bbe8..a24f88f 100644 --- a/tests/QueryTest.php +++ b/tests/QueryTest.php @@ -154,12 +154,22 @@ public function testWhereCountAllGreaterLessCompare() for ($x = 1; $x <= 10; $x++) { $user = $db->get(uniqid()); + $user->index = $x; + $user->index2 = mt_rand(1,2); $user->pages = 5; $user->save(); } $count = $db->count(); + $queryIndex = $db->query() + ->where('pages','>','4') + ->where('index','=','1') + ->where('index2','=','2') + ->results(); + + // print_r($queryIndex); + // FIRST TEST $query1 = $db->query()->where('pages','>','4')->results(); $query2 = $db->query()->where('pages','>=','5')->results();