-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
After update from version 2.20.0 to 2.20.1 the Hydratation generate unexpected Warning #11783
Comments
Please always share stack traces as plain text rather than images, as indicated in https://symfony.com/doc/current/contributing/code/stack_trace.html#stack-traces-in-your-web-browser Here is the code comparison: 2.20.0...2.20.1 You could try narrowing it down by following https://dev.to/greg0ire/bisecting-vendors-12kd |
Hello, We've just noticed this same error as well. |
Great job! Ping @goetas , can you please take a look? |
For anybody experiencing this, what would help would be:
|
I'm skeptical that the stacktrace posted in the screenshot and the commit are related. the changes in the commit affect the I also have tried to reproduce it with a few many to many collections and indexby options, but all of them worked as expected. |
I have the same issue, but can confirm that it is not related to the commit linked before. I have traced it back to #11694: reverting the sources changes from there fixes the issue.
What I can see from a debug run is that the What's interesting to see is that the aliases in the query do not start with
While the same query, executed earlier in the same request, does start with
That is where the error comes from, which is Resetting the alias counter when not returning the cached column sql works for me. See f5e0d89 for the changeset. It's quite late already, so I'm unable to create a full PR with tests at this time, and I'm also not sure this is the correct fix or that the fix should be done somewhere else. Maybe someone with more understanding of the internals can my research results to make a complete fix 😄 |
sorry for that.. I change image to stack trace in issue definition. |
Cc @dbannik |
Sorry @goetas , my bad. The issue we're having has the same error message but it's not coming from hydrate, it's coming from refresh() and reverting that commit does indeed fix it for us. |
The issue is triggered by having an index column: the result set mapping is setting the index alias as the first found column name here: orm/src/Query/ResultSetMapping.php Lines 226 to 239 in e3cabad
However, with the select query being regenerated, the result set mapping actually has two aliases for the same field, and the one that is selected in the orm/src/Internal/Hydration/ObjectHydrator.php Lines 508 to 509 in e3cabad
I think the issue is that each time the orm/src/Persisters/Entity/BasicEntityPersister.php Lines 2146 to 2149 in e3cabad
However, in the result set mapping that alias can either be stored as a field or meta result, so just looking into the field result map to return the already existing alias is probably a no go. That would mean that either the method using the I've added a failing test to show the issue: #11786 |
Bug Report
Summary
After updating to the latest version, hydration is not working properly. It generates a warning that ends up throwing an exception in the application.
Current behavior
The application runs on symfony 6.4 LTS. and PHP 8.4
we have ManyToMany connection between entitites...
composer doctrine depedencies:
Stack trace:
Expected behavior
does not generate a warning..
How to reproduce
for us it was reflected in the fact that we updated from version 2.20.0 to 2.20.1
The text was updated successfully, but these errors were encountered: