我在我的管理员中包含了一个相关模型,如下所示
->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',
))
包含子管理员,我可以添加新行。但是,当我尝试添加第二个孩子时,我收到以下错误:
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".
我无法解释发生了什么,我正在使用symfony 2.7.3并使用Admin bundle的dev-master分支。 我不知道这是否已被报道,我已经尝试检查问题清单但没有看到它
答案 0 :(得分:8)
你得到了这个例外,因为你忘了在父构造函数中初始化子集合。
{{1}}
在您的示例中, children 必须是参数。