How to Override the ORM Product Value¶
In some cases, you may need to extend and replace the Pim:Catalog:ProductValue to be able to link some objects with it.
For example, let’s say we want to link the product values with a Color model. Depending on your needs, a product value can be linked to several colors or just to one. The first case will be detailed in Linking the ProductValue to a Simple Object while the second is documented in Linking the ProductValue to a Collection of Objects.
Once the link between your custom model and the product value has been set up, please continue to Registering the Custom Product Value Class.
Registering the Custom Product Value Class¶
First, configure the parameter for your ProductValue class:
# /src/Acme/Bundle/AppBundle/Resources/config/entities.yml parameters: pim_catalog.entity.product_value.class: Acme\Bundle\AppBundle\Entity\ProductValue
Don’t forget to register your entities.yml file in your bundle’s extension.
Then, check that your mapping override is correct by launching the following command: (you should see your Acme\Bundle\AppBundle\Entity\ProductValue class):
php app/console doctrine:mapping:info
Now you are ready to perform a Doctrine schema update and use your own ProductValue class.