Closed code28 closed 4 years ago
Hey, thanks for your feedback! I think it would be very difficult to include eager loaded children into a parent indexAll Route as the parent controller does not know about the child model. But it would be possible to add an extra route for parent with eager loaded children. Assuming Todo -> Tags relationship:
/todos // with eager loading not possible/very difficult
/todos/with-tags // easy to implement
But I am not happy with the syntax. Do you have a suggestion for with-tags
?
After discussion on Discord we decided not to add an eager-loading route but to provide an (currently undocumented) option to customize the CRUDController
to add eager loading.
Nice work! I also just used a generic approach in one of my projects (but way less sophisticated), so I'll definitely consider using this in the future!
One thing is missing for my use case: Eager loading of children on
indexAll
. I know, it's maybe not that simple CRUD-style, but it's definitely useful to adjust the query.Right now, I unfortunately don't have the time to study your code and make a PR, maybe you can find a solution for this easily. Otherwise I'll look into making a PR when I get some spare time. :)