Is it possible to split a nested lazy loading method?
I´ve got
$this->user->load('latestConversations.latestMessage.user')
I´d also like to load all Users assigned to latestConversations so something like this would be nice:
$this->user->load('latestConversations.['users', 'latestMessage.user']')
Here is a workaround
$this->user->load('latestConversations.latestMessage.user')
$this->user->load('latestConversations.users')
But then latestConversations are queried two times.
If you leave the parentheses on the relation method you can just add on whatever you want to the query, and then manually set the relation using
setRelation()
. I haven't tested it but something like this should work: