Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable fetching of nested polymorphic relations. #1928

Closed
atrauzzi opened this issue Jul 22, 2013 · 1 comment
Closed

Enable fetching of nested polymorphic relations. #1928

atrauzzi opened this issue Jul 22, 2013 · 1 comment

Comments

@atrauzzi
Copy link
Contributor

If you look at the following method: https://github.com/atrauzzi/authoritaire/blob/master/src/Atrauzzi/Authoritaire/Model/Role.php#L28

I have to implement a workaround to retrieve instances of my polymorphic relation via the join model. I keep getting the message "Class name must be a valid object or a string" when I try to use:

return $this
    ->memberships()
    ->with('authorizable')
    ->get()
;

More importantly, my having to do this is as a result of being unable to automatically join across a join table with a half-polymorphic many-to-many relation: #1922

@taylorotwell
Copy link
Member

Eager loading a polymorphic relation from the morphed model is not supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants