APYDataGridBundle icon indicating copy to clipboard operation
APYDataGridBundle copied to clipboard

Finalize query on Entity source

Open fantoine opened this issue 11 years ago • 4 comments

I would like to be able to update queries used on Entity sources before they are fetched.

The main reason is that I want to set fetch mode to eager to some relations I use on manipulated renders or custom columns. However I didn't see a way to update the query, but only the querybuilder.

Maybe, adding a method which could be overridden on Entity subclasses could be useful:

protected function finalizeQuery(Doctrine\ORM\Query $query) {}

fantoine avatar Nov 21 '14 14:11 fantoine

Or it may also be a parameter on Column annotation.

fantoine avatar Nov 21 '14 14:11 fantoine

Indeed, this is a great idea. L'd like to add this in the master version, can you do a PR.

Abhoryo avatar Nov 21 '14 14:11 Abhoryo

I see that you can set the fetch mode in your entity directly.

You only want for some case ?

Abhoryo avatar Nov 21 '14 20:11 Abhoryo

Yes, I don't want to use the eager fetch mode every time, but specifically to some cases. I just want to optimize queries according to their usage.

I'll try to do some pull requests but I'm not using the master branch on my project and can't switch to it for some reasons, so I can't promise anything.

fantoine avatar Nov 21 '14 21:11 fantoine