This is the first example I could come up with, it is not very good, but it gives you an idea:
$db = new Database(); $filteredList = $db->select() ->from('my_table') ->where('id', 9) ->run() ->filter(function($record){
There I will use free interfaces to query my database using some ORM, and then apply some filter to the recordset that I get. Imagine that the run() method returns a RecordSet object that has a filter() method, which could be something like this:
public function filter ($callback) { return array_filter($this->recordSet, $callback); }
Do you have an idea?
source share