Symfony Admin Generator Calling Actions with Custom Parameters
The administration module actions can receive custom parameters using the query_string argument in a link_to() helper. For example, to extend the previous _edit_header partial with a link to the comments for the article, write this:
It filters the comments to display only the ones related to $article. Using the query_string argument, you can specify a sorting order and/or a filter to display a custom list view. This can also be useful for custom interactions.
Override index function
public function executeIndex(sfWebRequest $request)
{
// For filter.. This code was missing in symfony documentation.
if ($request->getParameter('filter'))
{
$this->setFilters($request->getParameter('project_filters'));
}
//-----------------
// sorting
if ($request->getParameter('sort'))
{
$this->setSort(array($request->getParameter('sort'), $request->getParameter('sort_type')));
}
// pager
if ($request->getParameter('page'))
{
$this->setPage($request->getParameter('page'));
}
$this->pager = $this->getPager();
$this->sort = $this->getSort();
}
Similar Posts
- Fixing IE7 dropping PHP Sessions
- How Can Dawkins Explain the Perfect Eye in Our Brains?
- Nokia 5320 Xpress Music Hands ON!
- Google Nexus One: The Story
- Circle Dock


admin on September 1st, 2009 at 9:11 PM
@B@D
When it was, No one bothered to post