Skip to content
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

Schema validator doesn't report invalid indexBy configuration. #11608

Open
janklan opened this issue Sep 23, 2024 · 0 comments · May be fixed by #11610
Open

Schema validator doesn't report invalid indexBy configuration. #11608

janklan opened this issue Sep 23, 2024 · 0 comments · May be fixed by #11610

Comments

@janklan
Copy link

janklan commented Sep 23, 2024

Bug Report

Q A
BC Break no
Version Tested on 2.x and 3.x

Reproducer

https://github.com/janklan/doctrine-bug-11608. Follow the instructions in README.md to see the bug in action.

A detail of what's happening

  1. In my reproducer, the Plan::$subscription collection uses custom indexBy to allow fetching a Subscription using a Customer ID when known.
  2. The value of indexBy is deceiving because it matches the name of the property but not the name of the DB column
  3. As a result, Doctrine fails to set the collection index, falling back to numeric indexes as if the indexBy wasn't used.

Consequence

  1. Hard-to-debug errors when using Collection methods working with the keys

What's wrong

  1. I expected bin/console doctrine:schema:validate to pick up on this misconfiguration

Related issues

I reckon this one is quite relevant #4203

janklan added a commit to janklan/orm that referenced this issue Sep 24, 2024
janklan added a commit to janklan/orm that referenced this issue Sep 24, 2024
janklan added a commit to janklan/orm that referenced this issue Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant