Yii2 hasOne vs hasMany param order

hasOne()

* 
* public function getCountry()
* {
*     return $this->hasOne(Country::className(), ['id' => 'country_id']);
* }
*

hasMany()

*
* public function getOrders()
* {
* return $this->hasMany(Order::className(), ['customer_id' => 'id']);
* }
*

Notice the opposite order? The docs explain why but it’s still confusing.

Ticket submitted.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.