在Sylius中自定义模型。主义错误:财产"翻译"在" AppBundle \ Entity \ Product"已经宣布了

时间:2016-12-19 02:39:17

标签: doctrine symfony sylius

我正在尝试根据此文档页面自定义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  

有什么想法吗?谢谢。

1 个答案:

答案 0 :(得分:1)

您需要覆盖模型的配置。将其添加到您的配置

sylius_product:
    resources:
        product:
            classes:
                model: AppBundle\Entity\Product