nozavroni / csvelte

🕺🏻 CSV and Tabular Data library for PHP
http://phpcsv.com/
Other
6 stars 0 forks source link

Collection filter criteria class #161

Closed nozavroni closed 6 years ago

nozavroni commented 7 years ago

I've been studying the doctrine/collection library and one good idea I want to implement (possibly) is a dedicated criteria class that would allow me to remove all those "WHERE_" class constants from the collection class and instead of:


$coll = collect(get_data_from_somewhere());
$keyStartsWithFoo = new Criterion\Like("foo%", 'key'); // optional key
$keyRegExp = new Criterion\RegExpLike("/[a-z]+\.[0-9]+/i", 'key'); // optional key
$where = new Criterion\LogicalOr([$keyStartsWithFoo, $keyRegExp]);
foreach ($coll->select($where) as $key => $val) {
    // the above may be a little more complex than I actually need... we'll see...
}
nozavroni commented 6 years ago

Collections are in their own repo now... although something like this could be considered there...

https://github.com/nozavroni/collect/issues/32