Answer the question
In order to leave comments, you need to log in
How to make hasMany relation from 2 tables in yii2?
There is a
texture (id, url) table,
as well as user_layer(id, texture_id) and object_layer(id, texture_id) tables.
There is a relationship in the Texture model:
public function getLayers()
{
return $this->hasMany(UserLayer::class, ['texture_id' => 'id']);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question