Skip to content

[Form] ORMQueryBuilderLoader::getEntitiesByIds executing query despite that Entity is already loaded #57780

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

Open
oleg-andreyev opened this issue Jul 19, 2024 · 6 comments

Comments

@oleg-andreyev
Copy link
Contributor

Symfony version(s) affected

6.4.x

Description

I have a page with form where I have collection of items and each time has AutoComplete Field (https://symfony.com/bundles/ux-autocomplete/current/index.html)

  1. I've re-loaded all required entities using IN (...) so they are in UoW
  2. Without Autocomplete is just a wrapper over EntityType
  3. No custom query_builder
  4. But as soon as ORMQueryBuilderLoader::getEntitiesByIds it does not even try to check current UoW and forces execute query (ignoring UoW cache)

How to reproduce

Possible Solution

Since we have access to UoW, try to check memory before executing QB.

\Doctrine\ORM\UnitOfWork::tryGetById will return entity or null, if entity returned, we can reduce $values and execute on "rest"

Additional Context

No response

@oleg-andreyev oleg-andreyev changed the title [Form] ORMQueryBuilderLoader::getEntitiesByIds [Form] ORMQueryBuilderLoader::getEntitiesByIds executing query despite that Entity is already loaded Jul 19, 2024
@xabbuh
Copy link
Member

xabbuh commented Jul 20, 2024

Can you create a small example application that allows to reproduce your issue?

@xabbuh
Copy link
Member

xabbuh commented Jul 29, 2024

I am going to close here for now due to the lack of feedback. Please let us know when you have more information and we can consider to reopen.

@xabbuh xabbuh closed this as not planned Won't fix, can't repro, duplicate, stale Jul 29, 2024
@oleg-andreyev
Copy link
Contributor Author

@xabbuh today had some time to create small repo https://github.com/oleg-andreyev/bug_app/tree/issue-57780

@oleg-andreyev
Copy link
Contributor Author

@xabbuh ping

@carsonbot
Copy link

Hey, thanks for your report!
There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?

@carsonbot
Copy link

Could I get an answer? If I do not hear anything I will assume this issue is resolved or abandoned. Please get back to me <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants