I'm trying to customize the Product Model in Sylius based on this documentation page: Sylius Customization Guide: Customizing Models.

In AppBundle I created my own class 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
 {
    ...
 }

But when I run

 $ php bin/console doctrine:schema:update --force

I get this error:

 [Doctrine\ORM\Mapping\MappingException]                                                                        
 Property "translations" in "AppBundle\Entity\Product" 
 was already declared, but it must be declared only once  

Any ideas? Thank you.

1

There are 1 answers

0
Antonio Peric On BEST ANSWER

you need to override config for your model. Add this to your configuratioN

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