PHP Doctrine: filtering data which is already loaded?

Posted by ropstah on Stack Overflow See other posts from Stack Overflow or by ropstah
Published on 2010-03-23T01:01:43Z Indexed on 2010/03/23 18:03 UTC
Read the original article Hit count: 190

Filed under:
|

I'm new to Doctrine and ActiveRecord.

How should I filter a table after it has been loaded? (i suppose this is preferred over sending multiple queries?)

Is this 'good' or 'bad'?

class UserTable extends Doctrine_Table {
    function filterByGroup($group) {
        $ut = new UserTable();
        foreach($this as $u) {
            if($u->group = $group) $ut->add($u);
        }
        return $ut;
    }
}

© Stack Overflow or respective owner

Related posts about php

Related posts about doctrine