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

前端 未结 2 1127
孤独总比滥情好
孤独总比滥情好 2020-12-15 14:54

I\'ve hitting my head against the wall for countless hours now and I hope SO can be of help!

I have Retailer, Branch and RetailerBranches entities which work just fi

相关标签:
2条回答
  • 2020-12-15 15:39

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

    .

    0 讨论(0)
  • 2020-12-15 15:45

    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

    0 讨论(0)
提交回复
热议问题