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

Move beforePaginate() of RelatedModelsListener in a separate listener. #685

Open
ADmad opened this issue Dec 19, 2022 · 2 comments
Open

Comments

@ADmad
Copy link
Member

ADmad commented Dec 19, 2022

Containing related model in the query is a very different operation than setting view vars for select options for related models.

Also CrudView's ViewListener contains associated models in it's beforePaginate() and beforeFind(), so having a separate listener in Crud for containing would allow better control.

@ravage84
Copy link

@ADmad

Containing related model in the query is a very different operation than setting view vars for select options for related models.

Agreed.

Unfortunatley, the documentation could be more clear about this and the sad fact that the two behaviors can't be controlled separately, at the moment.

Also, the current behavior can lead the application to load the full data of potentially large database tables.
Because of this, we recently ran into a performance/memory limit issue.

Also CrudView's ViewListener contains associated models in it's beforePaginate() and beforeFind(), so having a separate listener in Crud for containing would allow better control.

While a separate listener would certainly be much cleaner, a simple flag for controlling the view variable population would probably be much easier to implement.
Also, less complicated to keep backwards compatibility.

If you are open to the idea of such a flag, me or my team mate @T0nyDamage would be interested to contribute.

@ADmad
Copy link
Member Author

ADmad commented Nov 28, 2024

I still want this to be a separate listener but I guess we can have a config as a stop gap solution. Please make a draft PR and we can see.

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

No branches or pull requests

2 participants