title: PHP Doctrine: filtering data which is already loaded?
body: <p>I'm new to Doctrine and ActiveRecord.</p>
  
  <p><strong>How should I filter a table after it has been loaded?</strong> (i suppose this is preferred over sending multiple queries?)</p>
  
  <p>Is this 'good' or 'bad'?</p>
  
  <pre><code>class UserTable extends Doctrine_Table {
      function filterByGroup($group) {
          $ut = new UserTable();
          foreach($this as $u) {
              if($u-&gt;group == $group) $ut-&gt;add($u);
          }
          return $ut;
      }
  }
  </code></pre>
  
  <h1>Edit:</h1>
  
  <p>I understand there are built-in functions which provider 'filtering' functionality. But will the two following code-blocks perform differently regarding performance?</p>
  
  <pre><code>//1
  $users = Doctrine_Core::getTable('Users')-&gt;findAll();
  $admins = Doctrine_Core::getTable('Users')-&gt;findByGroupName('admin');
  //2
  $admins = Doctrine_Core::getTable('Users')-&gt;findByGroupName('admin');
  $users = Doctrine_Core::getTable('Users')-&gt;findAll();
  </code></pre>