Symfony2 1:M / 1:1 Relationship and Sonata Admin Form

懵懂的女人 提交于 2019-11-29 00:40:11

For those running into the same problem, I posted the solution on GitHub

.

When needing to edit OneToOne or other relationships on the same page in Sonata Admin you could also create Admin classes for each Entity (and add to config.yml) and simply add the entire entity to your form in you main Admin class like so:

protected function configureFormFields(FormMapper $formMapper)
    $formMapper
    ->add('yourLinkedProperty', 'sonata_type_admin')
    //other form fields
    ->end()

see Sonata Doc http://sonata-project.org/bundles/admin/master/doc/reference/form_types.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!