- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在我的管理员中包含了一个相关模型,如下所示
->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',
))
包含子管理员,我可以添加一个新行。但是,当我尝试添加第二个 child 时,出现以下错误:
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 分支。不知道有没有被举报,我试过在问题列表里查了也没看到
最佳答案
你得到这个异常是因为你忘记在父构造函数中初始化子集合。
// src/AppBundle/Entity/Parent.php
function __construct() {
$this->children = new \Doctrine\Common\Collections\ArrayCollection();
}
在您的示例中,children 必须是 parameters。
关于symfony - sonata_type_collection 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32130170/
我对 Sonata 管理表单有疑问... 我想在专辑中插入音乐,位置... 我的问题是当我创建一个专辑时...我可以添加很多我想要的 AlbumHasMusic...但是当我提交我的表格时...每个
在使用 Sonata Admin 包的 Symfony2 应用程序中,我有两个实体: 公司属性 CorporateAttributesApi 与教义相关的内容如下: CorporateAttribut
我在我的管理员中包含了一个相关模型,如下所示 ->add('parameters', 'sonata_type_collection', array( 'type_options' =
我将 sonata_type_collection 用于订单内的订单行。创建新订单后,我可以单击按钮添加订单行。 是否可以将其更改为在页面加载时自动显示 5 行,而不是单击第一行的按钮等等? 我想可以
我有一个相当常见的用例,我正在尝试实现它,但遇到了 Symfony Sonata Admin Bundle (ORM) 的一些问题。我的模型在 Facility 和 Sport 之间建立了关系,该关系
在 Sonata Admin 中,我想使用 Sonata_type_collection 中的上传和预览图片文件。 在我的 Admin/ItemAdmin.php 中: class ItemAdmin
我有一个 Trip 实体,其中有许多 HoneymoonComponent。在 TripAdmin 中,我使用 sonata_type_collection 来编辑内联所有 HoneymoonComp
是否可以覆盖以下表单类型的模板:“sonata_type_collection”? 香港专业教育学院试图遵循以下思路: $formMapper->add('slides', 'sonata_type_
简而言之: 当我在 OneToMany 关系中使用“sonata_type_collection”时,我必须指定关系的另一端,在“创建操作”中仍然不存在,并且可以在“更新操作”中设置,但也可以指定完全
有没有人知道我如何摆脱允许向奏鸣曲管理表单中的集合添加新项目的绿色加号? native 集合类型有allow_add 和allow_delete,但sonata_type_collection 似乎没
我正在尝试使用 PageHasImage 桥接实体在 Page 和 Image 实体之间实现多对多关系。在 PageAdmin 中,我添加了如下字段: ->add( 'galleryIma
我正在使用 SonataAdminBundle 来管理我正在处理的项目的后端。在这种情况下,我想将一个或多个图像添加到“项目”。这是实体的相关部分 src/My/Bundle/Entity/Item.
我是一名优秀的程序员,十分优秀!