Symfony 1.4 (Doctrine) admin generator: How to call symfony 1.4 admin generated filter options via a url

1.1k Views Asked by At

I have an admin-generated frontend that has lots of filter options available. Can I call the page via a URL and choose different filter options per URL?

eg. URL 1 = /clients/filters=caseworker_id=2 URL 2 = /clients/filters=isActive=true

I used to do something similar in Symfony 1.0 but can not find the right way to do it in 1.4

thanks

1

There are 1 best solutions below

1
On BEST ANSWER

Have you tried to use an auto-generated filter action?

public function executeFilter(sfWebRequest $request)
{
  $this->setPage(1);

  if ($request->hasParameter('_reset'))
  {
    $this->setFilters($this->configuration->getFilterDefaults());

    $this->redirect('@auto_brand_history');
  }

  $this->filters = $this->configuration->getFilterForm($this->getFilters());

  $this->filters->bind($request->getParameter($this->filters->getName()));
  if ($this->filters->isValid())
  {
    $this->setFilters($this->filters->getValues());

    $this->redirect('@auto_brand_history');
  }

  $this->pager = $this->getPager();
  $this->sort = $this->getSort();

  $this->setTemplate('index');
}

Seems like it can work with GET parameters too.