Open adamdyson opened 8 years ago
Yes it has:
$bookMapper = $spot->mapper('BookEntity');
$books = $bookMapper->all()->with('author');
See the docs: http://phpdatamapper.com/docs/relations/#Eager_Loading
@nebulousGirl Thanks for the reply, however I'm asking whether nested relationships can be eager loaded. The example you posted and the documentation simply shows how to load a direct relationship. Ideally I'm wanting to achieve:
$bookMapper = $spot->mapper('BookEntity');
$books = $bookMapper->all()->with(['author.contacts', 'publisher']);
Nested relationship eager loading is not currently supported, but it certainly would be nice.
I'm curious what the chances are of this ever being implemented?
I would really like to see this implemented as well. We just need someone with the time to tackle it. Unfortunately, I can't do it at the moment. I might have some time in the next few months.
I'm evaluating various PHP ORM's that allow nested relationships to be eager loaded. Does this library have similar functionality to Propel, CakePHP, Eloquent etc?