编辑:解决方案原来是这样的:
public function executeIndex sfWebRequest $ request) { if($ request-> getParameter('first_name')){ $ this-> setFilters(array('first_name'=> $ request- >的getParameter( '如first_name'))); } parent :: executeIndex($ request); }所以,我刚刚开始使用symfony管理生成器,这很棒。但是,我想知道,我如何使用GET请求过滤列表?例如/ users?name = Simon
如果我尝试:/ users / filter / action / users [name] / Simon
所有我想要做的是创建一个链接列表到另一个。例如在每个用户列表记录中点击查看此用户的帖子将会将您发送到帖子屏幕,但由用户过滤。
如果这样,我不会感到惊讶实际上可以通过generator.yml来完成,但是我不知道如何。
提前感谢您提供的任何帮助。
解决方案我的答案解释了你所需要的: symfony - 作为链接可访问的管理模块过滤
EDIT: The solution turned out to be along these lines:
public function executeIndex(sfWebRequest $request) { if ($request->getParameter('first_name')) { $this->setFilters(array('first_name' => $request->getParameter('first_name'))); } parent::executeIndex($request); }Hi,
So, I've just started using symfony admin generator and it's great. But, I want to know, how I can I filter the lists using a GET request? e.g. /users?name=Simon
If I try: /users/filter/action/users[name]/Simon
It complains there is no CSRF token, because usually you filter by using the filter form it generates for you.
All I want to do is create links from one list to the other. e.g. clicking "See this User's Posts" in each user list record will send you to the Posts screen but with it filtered by this user.
I wouldn't be surprised if this could actually be done by the generator.yml but I don't know how, yet.
Thanks in advance for any assistance you can provide.
解决方案My answer here explains what you need: symfony - admin module filters accessible as links
更多推荐
Symfony教义管理生成器列表过滤器获取没有csrf令牌的方法
发布评论