Sonata Admin type_collection & cascade validation
collections, sonata-admin, symfony, validation
Solution
You have to enable cascade_validation. You can do it this way:
class UserAdmin extends SonataUserAdmin
{
protected $formOptions = array(
'cascade_validation' => true
);
/* Rest of your admin class code */
}
Problem
I am having a problem with implementing the one to many relationship in the sonata admin 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 default validation defined in AdhesionAdmin like 'required' => true. So, is there a setting to specify somewhere ? I tried to add 'cascade_validation' => true in settings of the sonata_type_collection but it has not changed. Another question: can I use popup edit form with the sonata_type_collection ? ('edit' => 'standard') Any pointers and help is highly appreciated. Thank you