-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make entities extendable #97
Conversation
@lchrusciel @Zales0123 @tautelis The error:
The plugin is overriding our configuration : sylius_resource:
resources:
sylius_invoicing_plugin.line_item:
classes:
model: App\Entity\LineItem <?php
declare(strict_types=1);
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Sylius\InvoicingPlugin\Entity\LineItem as BaseLineItem;
/**
* @ORM\Entity
* @ORM\Table(name="sylius_invoicing_plugin_line_item")
*/
class LineItem extends BaseLineItem
{
} We don't have this problem with BitBag plugins. FYI @prigal |
sylius_invoicing:
resources:
line_item:
classes:
model: App\Entity\InvoicingLineItem
|
Hello, This feature is really important for me and according to you answer I know if I have to wait or no. |
@sylius/core-team up ? :) |
@pierre-H yes, for sure this is something we should merge to the plugin. For the next plugin release, we need also integration with shop billing data moved to a Sylius Core (see #94). Regarding this PR - we need right now to disable |
0c975a9
to
3e5885c
Compare
@Zales0123 @tautelis What we also need is integration with other changes that occurred in Sylius 1.4 ( i.e. the .env files convention). The update of Sylius version in InvoicingPlugin will happen in a while, merging the update-related PR and then rebasing this one with master will make the whole process much easier. To sum up, stay tuned :D |
@bartoszpietrzak1994 it depends how long the "in a while" is but ok, i will wait :) |
We can also JUST FOR NOW stay on Sylius 1.3 only (as it has been done for RefundPlugin) to make this PR pass and update to Sylius 1.4 afterward. In the end, supporting |
@Zales0123 @tautelis The integration with Sylius 1.4 has just been merged. I'll rebase this PR, resolve potential conflicts and see how it'll work. |
3e5885c
to
b1f716e
Compare
Hello @tautelis After some investigation, it occurred that unfortunately there is a bug in Sylius which make the combination of MappedSuperclass and embeddable not working. The only possible solution that would make your changes work right now is to provide a hotfix in the InvoicingPlugin code and remove it once new minor Sylius version is released. It is hard to tell how time-consuming it would be. The other solution that comes to my mind is to get rid of the embeddables and provide associations between both Invoice and InvoiceChannel and Invoice and ShopBillingData. However, that would cause unpleasant BC-breaks (as well as data migrations) and would not solve the root of the problem. |
@bartoszpietrzak1994 it's not a stable version yet so people are expecting BC breaks. Even Sylius itself had a BC breaks even on bugfix versions. |
@bartoszpietrzak1994 @tautelis for now maybe juste don't make extendable the embeddable entities I think the only one embedded is InvoiceShopBillingData. |
@wadjeroudi what do you mean by "remove the mapped-superclass for InvoiceShopBillingData". InvoiceShopBillingData is not mapped-superclass. Invoice is mapped superclass so probably you mean to remove mapped-superclass from invoice (the main plugin entity)? |
Anyhow, for certain reasons our project is locked to symfony If interested here we made it extendable: Here useless invoice repository definition removed to follow sylius standard: The latter should work for latest master as well. |
This is also a problem in the RefundPlugin. I tried this blindly without checking in #122 and ran into the embedded-Problem. We really need to fix this. Our temporary solution for this is to override the place where doctrine looks for mappings for a bundle and move all the doctrine mappings to app/Resources//config/doctrine and change the mapping type to mapped-superclass where needed (currently only on the invoice entity, but on 1.3. the embedded works for some reason) Relevant PR on RefundPlugin: Sylius/RefundPlugin#130 |
Addendum to my last comment: We told doctrine to look for mappings in a different folder for a bundle, but only changed one entity from entity to mapped superclass. That entity does not use embeddables which is why our setup works. I can offer more information if needed :) |
This PR should pass after Sylius/SyliusResourceBundle#89 is merged and used by this plugin. |
51b3eda
to
f57ce0f
Compare
Thank you, Vytautas! 🥇 |
This makes it possible to extend entities in sylius-like manner.
Closes #128, fixes #120.