-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreadme.txt
28 lines (20 loc) · 975 Bytes
/
readme.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
== Description ==
Construct SQL WHERE clauses, filter arrays/iterators, etc.
Author: Christian Lück <[email protected]>
Homepage: https://github.com/clue/Filter
License: MIT-style license
== Example ==
<?php
$filter = Filter::all(Filter::keyEq('name','Pete'),Filter::keyGt('id',10));
$filter->toSql(); // `name`='Pete' AND 'id'>10
foreach($filter->toIterator($users) as $user){ // iterate over all users matching the filter
}
$filtered = Filter::negate($filter)->apply($users); // only keep users that did NOT match filter
$filter->matches(array('name'=>'Pete','id'=>100)); // true
?>
== Requirements / Dependencies ==
* PHP 5.3+
== Known issues ==
* Converting a filter to a SQL query string (WHERE clause) requires access to a proprietary/unreleased database class.
Altough a possible option, I personally feel releasing yet another database abstraction layer class is totally redundant and should be avoided.
Any ideas on how to avoid this issue welcome!