简体   繁体   English

Sonata Admin如何读取未映射的字段?

[英]Sonata Admin how to read not mapped field?

I added fields with the option "mapped" => false to a SonataAdmin form. 我将带有"mapped" => false选项的字段添加到SonataAdmin表单中。

Now I need to access the values of the form fields marked with "mapped" => false in the method postUpdate . 现在我需要在postUpdate方法中访问标有"mapped" => false的表单字段的值。 How can I retrieve them? 我怎样才能找回它们?

You can simply get Form and filed data in your admin class. 您只需在管理类中获取表单并提交数据即可。 In method postUpdate: 在方法postUpdate中:

$fieldData = $this->getForm()->get('name_of_field')->getData();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM