PHP Doctrine: Filter Table?

Posted by ropstah on Stack Overflow See other posts from Stack Overflow or by ropstah
Published on 2010-04-06T00:35:51Z Indexed on 2010/04/06 0:43 UTC
Read the original article Hit count: 400

Filed under:
|
|

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?
    }
}

© Stack Overflow or respective owner

Related posts about php

Related posts about doctrine