How to create a link between 2 models without Has One/Many?

Hi all, have 2 models ALREADY received and filled in parallel.

How to aggregate one model to another?
to simulate the connection obtained via a hasOne/hasMany ?

simple ->related['myRelate'] = *model* ?

PS will Explain the specifics:

Is the basic model, and the information for her, which is stored in a separate table, and the result is a huge query with subqueries exclusive short through normal ->with('myRelate') not to.

Accordingly, at the output I have the array of models that need to be linked manually

April 4th 20 at 13:17
2 answers
April 4th 20 at 13:19
If Yii2:
April 4th 20 at 13:21
There is a very handy extension that allows you to use the code more succinctly: yii2-save-relations-behavior

Find more questions by tags Yii