从 SonataAdmin 中的表单访问 POST 数据 [英] Access POST data from a form in SonataAdmin

查看:18
本文介绍了从 SonataAdmin 中的表单访问 POST 数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的问题,如何在 sonataAdmin 中访问表单返回的原始 POST 数据?

I have a simple question, how can I access the raw POST data returned by a form in sonataAdmin?

我有一个使用 Javascript 创建表单的页面,我需要检索这些表单中的数据.问题是这些表单不是实体的属性,所以我不能让 Sonata 管理员为我自动链接它们.

I have a page that is creating forms using Javascript and I need to retrieve the data in those forms. The problem is that those forms are not attributes of the entity so I can't have Sonata admin linking them automatically for me.

推荐答案

基础管理类提供了一个 getRequest 方法,该方法返回 Request 对象.

The base admin class provides a getRequest method which returns the Request object.

有点像……

$request = $this->getRequest();
$postValue = $request->request->get('parameterName');

这篇关于从 SonataAdmin 中的表单访问 POST 数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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