Answer the question
In order to leave comments, you need to log in
Database Relationships in Yii2?
Hello.
A question. When I make links in phpmyadmin why do I need to make links in yii2 models. ? I have to enter
public function getOrders()
{
return $this->hasMany(Order::className(), ['customer_id' => 'id']);
}
Answer the question
In order to leave comments, you need to log in
Links in yii2 and in the database live a separate life. So - YES, you can not specify in the database. This will not affect the work of links in yii.
However, it is worth remembering that links in yii and in the database work differently - they do not delete related data, etc. It's just a link to get related data.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question