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

EXTRA_LAZY causing number of queries to triple. #5211

Closed
oleg-andreyev opened this issue May 2, 2022 · 4 comments · Fixed by #5343
Closed

EXTRA_LAZY causing number of queries to triple. #5211

oleg-andreyev opened this issue May 2, 2022 · 4 comments · Fixed by #5343
Milestone

Comments

@oleg-andreyev
Copy link
Contributor

oleg-andreyev commented May 2, 2022

Describe the bug
NumberField on OneToMany (EXTRA_LAZY) triples number of queries.
This is because method that is used to display field is called 3x.

On "virtual" field.

It's called from

  1. \EasyCorp\Bundle\EasyAdminBundle\Field\Configurator\CommonPreConfigurator::buildValueOption (isReadable)
  2. \EasyCorp\Bundle\EasyAdminBundle\Field\Configurator\CommonPreConfigurator::buildValueOption (getValue)
  3. \EasyCorp\Bundle\EasyAdminBundle\Field\Configurator\CommonPreConfigurator::buildTemplatePathOption (isReadable)

To Reproduce
Version: v4.0.10
Entity, with OneToMany, EXTRA_LAZY

(OPTIONAL) Additional context
With EXTRA_LAZY
image
image
image

Without EXTRA_LAZY
image

@parijke
Copy link
Contributor

parijke commented May 2, 2022

Interesting, following

@javiereguiluz
Copy link
Collaborator

This might be a Doctrine issue? The EXTRA_LAZY means "don't fetch this unless needed" ... but that should only be true for the first time that you try to fetch that data. After that first time, the following two times that value should already be fetched, right?

@oleg-andreyev
Copy link
Contributor Author

@javiereguiluz the thing is that EasyAdmin is mapped to a "virtual field" which does some calculation inside (Collection::count) and PersistedCollection with EXTRA_LAZY always executes count query.

@ben29
Copy link

ben29 commented May 27, 2022

I have the same issue,

did you find any workaround or fix?

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.

4 participants