[英]SonataAdmin - form collections
I'm trying to embed a Product Variant
into my Product
admin using SonataAdminBundle
. 我正在尝试使用
SonataAdminBundle
将Product Variant
嵌入我的Product
管理员中。
So one
Product has many
Variants 因此,
one
产品具有many
变体
I have the following Entities: 我有以下实体:
Product.php
/**
* @var ProductVariant $variants
* @ORM\ManyToMany(targetEntity="ProductVariant", cascade={"persist", "remove"} )
**/
protected $variants;
ProductVariant.php
/**
* @ORM\ManyToOne(targetEntity="Product", inversedBy="variants")
* @ORM\JoinColumn(name="product_id", referencedColumnName="id")
*/
protected $product;
Now, I have the following in my Admin Form class: 现在,我的“管理表单”类中包含以下内容:
->add('variants','collection', array(
'type' => new ProductVariantType(),
'allow_add' => true,
), array(
'edit' => 'inline',
'inline' => 'table',
))
This displays the Add Button to add a new Variant, but after clicking on it, I'd expect the row to be inline
and within a table
, but these options don't seem to get triggered. 这将显示“添加按钮”以添加新的变体,但是单击它之后,我希望该行是
inline
并且位于table
,但是这些选项似乎不会被触发。
Thanks 谢谢
Only sonata_type_collection
supports options 'edit'
and 'inline'
. 仅
sonata_type_collection
支持选项'edit'
和'inline'
。 Not core collection
type. 不是核心
collection
类型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.