Sonata Admin type_collection & cascading confirmation

I had a problem with implementing a one-to-many relationship in a sonata administrator with the following structure.

->add('adhesions', 'sonata_type_collection', array('by_reference' => false,'required' => false), array(
    'edit' => 'inline',
    'inline' => 'table',
    'sortable'  => 'position',))

With this option: "edit" => "inline", I lost the default check defined in AdhesionAdmin as "required" => true.

So, is there a parameter that needs to be specified? I tried adding 'cascade_validation' => true in the sonata_type_collection settings, but it has not changed.

Another question: can I use the popup edit form with sonata_type_collection? ('edit' => 'standard')

Any pointers and help are greatly appreciated. Thanks you

+5
source share
2

cascade_validation. :

  class UserAdmin extends SonataUserAdmin  
  {    
     protected $formOptions = array(
        'cascade_validation' => true        
     );

     /* Rest of your admin class code */


  }
+15

Valid :

/**
 * @var Object[]
 *
 * @ORM\OneToMany(targetEntity="AppBundle\Entity\Object", mappedBy="myEntity")
 * @Assert\Valid
 */
private $objects;

http://symfony.com/doc/current/reference/forms/types/collection.html#cascade-validation

+6

All Articles