Symfony教义管理生成器列表过滤器获取没有csrf令牌的方法 [英] Symfony doctrine admin generator list filters get method with no csrf token

查看:168
本文介绍了Symfony教义管理生成器列表过滤器获取没有csrf令牌的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑:解决方案原来是这样的:

  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令牌的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆