Skip to content

Commit

Permalink
Adds examples of overriding getBaseQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer committed May 13, 2012
1 parent 5a85d2f commit d77c7a0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,20 @@ Customizing the List View
-------------------------

Where before, you may have specified the `getTableMethod` parameter, now you override the `getBaseQuery()` function in your actions.class.php. By default,
this returns a `Doctrine_Query` object from your model's table by calling the `createQuery()` function. Override this to add where clauses and other
this returns a `Doctrine_Query` object from your model's table by calling the `createQuery()` function. Override `getBaseQuery` to add where clauses and other
customizations. Just be sure that method returns a `Doctrine_Query` instance, and you'll be all set!

// override getBaseQuery and join in the User table
protected function getBaseQuery()
{
$query = parent::getBaseQuery();
$a = $query->getRootAlias();
$query->select($a.'.*, u.first_name, u.last_name')
->leftJoin($a.'.User u');
return $query;
}

Forms and Filters
-----------------

Expand Down

0 comments on commit d77c7a0

Please sign in to comment.