Sylius: Two plugins modify one doctrine Entity

Created on 21 Sep 2018  路  1Comment  路  Source: Sylius/Sylius

Hi all

I started to study Sylius, and I can't find answer for my question.

For example
I have two plugin. PluginOne, PluginTwo. Installing it into composer trought private repository (for example: saits)
I have one Doctrine Entity Sylius\Component\Product\Model\Product

Each on my plugin customize model Sylius\Component\Product\Model\Product.
For example

PluginOne - added field guid into entity
PluginTwo - added filed content_hash into entity

How can I do it?
I follow this docs
https://docs.sylius.com/en/1.2/customization/model.html
But can't find answer for my question.

Help Wanted

Most helpful comment

There is no right answer sadly. One way is to create plugins that override core models with traits, so that if 2 plugins extends the same model, you just have to override it in AppBundle and use both plugins traits. If those plugins does not use traits, you'll manually have to copy methods and attributes into an override.

>All comments

There is no right answer sadly. One way is to create plugins that override core models with traits, so that if 2 plugins extends the same model, you just have to override it in AppBundle and use both plugins traits. If those plugins does not use traits, you'll manually have to copy methods and attributes into an override.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xleliberty picture xleliberty  路  3Comments

mikemix picture mikemix  路  3Comments

reyostallenberg picture reyostallenberg  路  3Comments

igormukhingmailcom picture igormukhingmailcom  路  3Comments

hmonglee picture hmonglee  路  3Comments