views:

149

answers:

0

I'm still not convinced after my previous question and some experience.

Requirements:

I don't want to use an SQL query everytime a filterBy() function is called and still be able to call ->filterBy() on the returned table.

Please find the comment @ ObjectsTable class: "How to instantiate another table and add records which match the filter criteria?"

Usage:

$globaltable = new ObjectsTable(); //globally accessible variable
$globaltable->findAll(); //this call is made once at the beginning of the request

$globaltable->filterBy('somefield', $someValue); //this function is used all over the place

ObjectsTable class:

class ObjectsTable extends Doctrine_Table {
    function filterBy($field, $value) {
        //How to instantiate another table and add records which match the criteria?
    }
}