I have included a related model in my admin as follows
->add('parameters', 'sonata_type_collection', array(
'type_options' => array(
// Prevents the "Delete" option from being displayed
'delete' => false,
)
), array(
'edit' => 'inline',
'inline' => 'table',
'sortable' => 'position',
))
The child admin is included and I can add a new row. However, when I try to add a second child, I get the following error:
PropertyAccessor requires a graph of objects or arrays to operate on, but it found type "NULL" while trying to traverse path "parameters[0]" at property "0".
I cannot explain what is happening, I am using symfony 2.7.3 and using dev-master branch of Admin bundle. I don't know whether this has been reported, I have tried to check in the issues list but haven't seen it
You got that Exception because you forgot to initialize the childrens collection in the parent constructor.
// src/AppBundle/Entity/Parent.php
function __construct() {
$this->children = new \Doctrine\Common\Collections\ArrayCollection();
}
In your example, children must be parameters .