Reputation: 11
Question pretty much duplicates How to override SyliusCoreBundle Model User but answers in original question doesn't seem to cover it. So the question is:
sylius_resource: resources: sylius.user: classes: model: myVendor\myBundles\webBundle\Entity\User
but still project uses Sylius\Component\Core\Model\User model.
Upvotes: 1
Views: 344
Reputation: 413
You were almost there, and yes the below steps are not in the book yet - not sure why. Apart from the above you need to change the mapping in sylius.yml which is present in /vendor/sylius/sylius/src/Sylius/Bundle/CoreBundle/Resources/config/app/sylius.yml
Change in two places
sylius_installer:
classes:
user:
# model: Sylius\Component\Core\Model\User # comment this out
model: Acme\YourBundle\Entity\User
sylius_resource:
resources:
sylius.user:
driver: doctrine/orm
classes:
# model: Sylius\Component\Core\Model\User # comment this out
model: Acme\YourBundle\Entity\User
For your first question :
For your Second question : You can use annotations in the sources you define in your own bundle i.e Acme/YourBundle but within the sylius sub bundles like resourcebundle etc you need to use what is being used within it already.
If there is a better way to doing this - please let me know as well !
Upvotes: 1