1 week ago

MorthTo with multiple columns

Posted 1 week ago by spacedog4

I have an Activity and other models that have a polymorphic relationship with Activity. The models are in portugue, so I'l translate irProduction, Productionsteps, Productionissues

One Production can ha many activities, same as Productionsteps and Productionissues and Activity can have many productions, productionsteps and productionissues.

So I need a polymorphic relationship, the problem is each Model has not only one primary key, but a group of primary keys:

Production has a primary key formed by ('key_company', 'key_branch', 'key_production')

Productionsteps has a primary key formed by ('key_company', 'key_branch', 'key_production', 'key_productionstep)

Productionissues has a primary key formed by ('key_company', 'key_branch', 'key_production', 'key_productionissue)

So how can I create a polymorphic relation ship with these models if the method as for only one key?

Please sign in or create an account to participate in this conversation.