我正在尝试根据此文档页面自定义Sylius中的产品模型:Sylius Customization Guide: Customizing Models。
在AppBundle中,我创建了自己的类Product:
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Core\Model\Product as BaseProduct;
/**
* Class Product
* @ORM\Entity
* @ORM\Table(name="sylius_product")
*/
class Product extends BaseProduct
{
...
}
但是当我跑步时
$ php bin/console doctrine:schema:update --force
我收到此错误:
[Doctrine\ORM\Mapping\MappingException]
Property "translations" in "AppBundle\Entity\Product"
was already declared, but it must be declared only once
有什么想法吗?谢谢。
答案 0 :(得分:1)
您需要覆盖模型的配置。将其添加到您的配置
sylius_product:
resources:
product:
classes:
model: AppBundle\Entity\Product