Good day.

There are 3 tables and 2 entities, one of the tables contains general properties, the other 2 contain details of each entity.

The question of how to instantiate a particular class of an entity is not worth it, here you can use the single table template, but how to instantiate a particular class with details without additional communication.

"Now I rephrase the question correctly how to write my bike with square wheels"

I’m waiting for tips on sabzh, I don’t have to write about how to communicate in a concrete class with a class of specific details, and if I don’t know anything interesting, I’ll implement it this way.

    1 answer 1

    Good day! Try the ExtendedBehavior from this package: https://github.com/mdmsoft/yii2-ar-behaviors

    Yes, you still have to define the connection, but you don’t need to use it personally - the behavior will provide transparent access to the fields of the parent entity.