I'm trying to embed a Product Variant
into my Product
admin using SonataAdminBundle
.
So one
Product has many
Variants
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.
Thanks
Only sonata_type_collection
supports options 'edit'
and 'inline'
. Not core collection
type.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.