Open dreamsbond opened 6 years ago
Such relationships are supported by Limoncello as Many-to-Many
relationships.
Laravel example
posts
id - integer
title - string
body - text
videos
id - integer
title - string
url - string
comments
id - integer
body - text
commentable_id - integer
commentable_type - string
Could be implemented in Limoncello as
posts
id - integer
title - string
body - text
videos
id - integer
title - string
url - string
comments
id - integer
body - text
posts_comments
id - integer
id_post - integer
id_comment - integer
videos_comments
id - integer
id_video - integer
id_comment - integer
Such features as CRUD including filters would work out of the box.
how does the limoncello present the use of
commentable_id - integer
commentable_type - string
in other way, say "attachments" as a scenario.
so one table "attachments" could hold polymorphic relation between teachers and students.
how does limoncello way achieve them?
can you tell more about it?
Limoncello does not use xxx_id
and xxx_type
pairs to connect tables in a database but plain intermediate tables which provide ACID features which 'columns' approach cannot do.
If you have Student
, Teacher
and Attachment
models database structure could be
students
id - integer
name - string
...
teachers
id - integer
name - string
...
attachments
id - integer
...
students_attachments
id - integer
id_student - integer
id_attachment - integer
teachers_attachments
id - integer
id_teacher - integer
id_attachment - integer
Is it possible to implement the Polymorphic Relations in limoncello-php app?
just like the one in laravel does. https://laravel.com/docs/5.5/eloquent-relationships#polymorphic-relations