Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Commit

Permalink
Fixed #19 the AND query logic. (previously the where() query would on…
Browse files Browse the repository at this point in the history
…ly used the last one in the chain).
  • Loading branch information
timothymarois committed Jul 6, 2018
1 parent f18b24c commit 384245c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Database
* Stores the version of Filebase
* use $db->getVersion()
*/
const VERSION = '1.0.16';
const VERSION = '1.0.17';


//--------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/QueryLogic.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}));

Expand Down
10 changes: 10 additions & 0 deletions tests/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 384245c

Please sign in to comment.