Symfony 1.4, forward to a filtered list view

Today I wrote a new symfony module which needed to use the view of an old model as a detail view.
So the only thing thats missing is a call to the old module’s ‘list’ action with a preset filter value.
However the described

setFilter()

didn’t worked out, because it seems that you can’t set a filter for a different module.
So I analysed the user settings ( see “debug bar”) and came up with this solution:

$this->getUser()->setAttribute('myOldModule.filters', array('filter_att' => array('text' => intval($request->getParameter('id')))), 'admin_module');
$this->forward('myOldModule', 'index');

“myOldModule” = Model Name of backend module.

“filter_att” = The name of the model column you want to filter.

Leave a Reply