8000 symfony/doctrine-bridge 4.4.16 breaks indexBy funtionality · Issue #38861 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
symfony/doctrine-bridge 4.4.16 breaks indexBy funtionality #38861
Closed
@tannyl

Description

@tannyl

symfony/doctrine-bridge version(s) affected: 4.4.16

Description
After updating from version 4.4.15 to 4.4.16 the Symfony app Sylius breaks with the following error:

In MappingException.php line 621:
  Cannot find a field on 'Sylius\Component\Core\Model\ChannelPricing' that is mapped to column 'channelCode'. Either the field does not exi  
  st or an association exists but it has multiple join columns.

This is due to the use of indexBy here: https://github.com/Sylius/Sylius/blob/master/src/Sylius/Bundle/CoreBundle/Resources/config/doctrine/model/ProductVariant.orm.xml#L40

After the changes here symfony/doctrine-bridge@v4.4.15...v4.4.16 the indexBy needs to be the column name and not the field name as it used to.

The fix for this should be easy. Change "channelCode" to "channel_code". This does in fact fix the above error. But Sylius still breaks due to a new problem.

Now in 4.4.16 it ignores the indexBy and uses numbers as keys instead of what is defined in indexBy. Which in turn breaks Sylius again, as it expects the returned collection to have "channelCodes" as the keys.
Interesting enough, is that if I use the "id" in indexBy it correctly uses the ids as the keys in the collection

Please see the issue here as well: Sylius/Sylius#11970

How to reproduce
Install Sylius as decribed here https://docs.sylius.com/en/latest/getting-started-with-sylius/installation.html
Remember to only use doctrine-bridge version 4.4.15.
Verify it works.
Update to doctrine-bridge version 4.4.16
Run console/bin cache:clear

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0