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

Add support polymorphic relations #3

Open
brussens opened this issue Oct 30, 2018 · 2 comments
Open

Add support polymorphic relations #3

brussens opened this issue Oct 30, 2018 · 2 comments
Labels
type:feature New feature

Comments

@brussens
Copy link

In 2.0, it is very upsetting that there are no polymorphic relations out of the box.
It would be cool to be able to use such relations.
It would be very nice to use something like this:

return $this->hasMany(Comment::class, ['entity_id' => 'id'])
    ->polyTo(['entity_type'], static::class);
@samdark samdark added the type:feature New feature label Oct 30, 2018
@cebe
Copy link
Member

cebe commented Nov 1, 2018

Here is an implementation from Humhub: https://github.com/humhub/humhub/blob/4ea2e27bf7dafcc968c52569b3cbd760b0fa53d5/protected/humhub/components/behaviors/PolymorphicRelation.php

@rustamwin
Copy link
Member

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

No branches or pull requests

4 participants