开发者

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

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜