Customizing models in Sylius. Doctrine Error: Property "translations" in "AppBundle\Entity\Product" was already declared
Customizing models in Sylius. Doctrine Error: Property "translations" in "AppBundle\Entity\Product" was already declared
我正在尝试根据此文档页面在 Sylius 中自定义产品模型:Sylius Customization Guide: Customizing Models。
在 AppBundle 中我创建了自己的 class 产品:
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
有什么想法吗?谢谢。
您需要覆盖模型的配置。将此添加到您的配置中
sylius_product:
resources:
product:
classes:
model: AppBundle\Entity\Product
我正在尝试根据此文档页面在 Sylius 中自定义产品模型:Sylius Customization Guide: Customizing Models。
在 AppBundle 中我创建了自己的 class 产品:
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
有什么想法吗?谢谢。
您需要覆盖模型的配置。将此添加到您的配置中
sylius_product:
resources:
product:
classes:
model: AppBundle\Entity\Product