Sylius: Customer mapping is using the wrong interface

Created on 12 Jun 2019  路  8Comments  路  Source: Sylius/Sylius

Sylius version affected: 1.4.5 (possibly earlier versions as well)

Description
The sylius.shop_user resource uses the UserInterface instead of the new ShopUserInterface which should be used to make doctrine mappings more concise.

This issue is related with this: #9360 (and its solution proposal). @bitbager probably discovered this during the development of the WishlistPlugin which also broke because the ShopUserInterface exists, but is neither used in the doctrine mapping, nor in the resource configuration.

When trying to fix this by using resolve_target_entities for example, one ends up breaking both shop_user and admin_user because both use the same UserInterface.

Steps to reproduce
None, really. :( There is more information in the linked issue above.

Possible Solution
1) Adding ShopUserInterface as interface to the default resource configuration of sylius.shop_user, sylius.admin_user and sylius.oauth_user
2) Fix the .../CoreBundle/Resources/config/doctrine/model/Customer.orm.xml and use the correct interface there as well. (If another entity refers to a user with a UserInterface one should look at those as well.)

This will make entity extension and overriding much easier and is semantically more precise and its using existing classes designed for that exact purpose.

Potential Bug

Most helpful comment

Next patch release should happen within a week and it will include the fix in #10450.

All 8 comments

An interim solution could be to tell doctrine where to look for mappings for a specific namespace and then replace ALL mappings of the CoreBundle and only change the target-entity in the Customer.orm.xml (while having the solution of #9360 applied)

Related: #10408

Awesome - thank you so much. @bitbager will love to see this!

I've proposed a one-to-rule-them-all solution in https://github.com/Sylius/SyliusResourceBundle/issues/94#issuecomment-501568904 which should prevent issues like this in the future.

Since we are currently in the cleanup process of our 1.4.x update I am going to ask for a possible ETA (and tag) on https://github.com/Sylius/Sylius/pull/10450 :wink: :rocket:

Today, days or weeks is totally enough for me to decide how to take the very short term challenge of either hotfixing our setup or waiting a sprint or two to get this change. :wink: Honestly: No pressure :slightly_smiling_face:

Next patch release should happen within a week and it will include the fix in #10450.

Awesome - thank you so much for that :heart:

10450 merged, will be out in the wild soon 馃帀

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ping86 picture ping86  路  3Comments

stefandoorn picture stefandoorn  路  3Comments

hmonglee picture hmonglee  路  3Comments

bnd170 picture bnd170  路  3Comments

igormukhingmailcom picture igormukhingmailcom  路  3Comments