Mas*_*iro 3 symfony symfony-sonata sonata-admin
我在我的管理员中包含了一个相关模型,如下所示
->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',
))
Run Code Online (Sandbox Code Playgroud)
包含子管理员,我可以添加新行.但是,当我尝试添加第二个孩子时,我收到以下错误:
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".
Run Code Online (Sandbox Code Playgroud)
我无法解释发生了什么,我正在使用symfony 2.7.3并使用Admin bundle的dev-master分支.我不知道这是否已被报道,我已经尝试检查问题列表但是没有看到它
小智 8
你得到了这个例外,因为你忘了在父构造函数中初始化子集合.
// src/AppBundle/Entity/Parent.php
function __construct() {
$this->children = new \Doctrine\Common\Collections\ArrayCollection();
}
Run Code Online (Sandbox Code Playgroud)
在您的示例中,子项必须是参数.
| 归档时间: |
|
| 查看次数: |
1932 次 |
| 最近记录: |