Code snippets for symfony 1.x


Refine Tags

Snippets tagged "filter filters"

Forward in filters

The regular use of forward is causing double content rendering and it took me a while to find the proper solution so here it is:

class SiteFilter extends sfFilter
  public function execute($filterChain)
    $context = $this->getContext();
      if(true){ // put some condition in here
        $context->getController()->forward('module', 'action');
        throw new sfStopException(); // the solution

As you can see sfStopException() is the key.

by rozwell on 2012-06-08, tagged content  double  filter  filters  forward  rendering