Closed tomsseisums closed 11 years ago
+1
I did the same yesterday and it's buggy, i guess. Because when i try to do,
$model->load('foo', 'bar');
it's working. I don't know how to solve this. But i was planning to open an issue. But @joltmode did it before me.
It is currently not possible to eager load from the morphed object.
It would be great if it will throw error like "Can't eager load from the morphed object" when trying to add morphed relationship to function with(). Thanks!
what is the current status of this issue, is it still not possible to eager load from the morphed object ?
I assume the reason is that it can't tell which models to query morphables for? Perhaps in the model it would be possible to list an array of morphTo models, so laravel knew what to query?
I'm pretty new to polymorphic relations, so, might be that I'm just imagining things, anyways, "morpher":
One of "morphables":
When I:
Everything goes smoothly, everything is eager loaded, no problems.
Though, when I try to eager load the other-way around:
I end up with a _Whoops!_:
It feels buggy, because, if I:
it works.
values table:
Am I doing something wrong, or is it a bug?