From hasMany() documentation
public function getOrders()
{
return $this->hasMany(Order::className(), ['customer_id' => 'id']);
}
customer_id is a column of Order class.
id is a column of Customer class.
From viaTable() documentation
public function getItems()
{
return $this->hasMany(Item::className(), ['id' => 'item_id'])
->viaTable('order_item', ['order_id' => 'id']);
}
Which class does id of hasMany() belongs to? Is it Order or Item?
Which class does item_id of hasMany() belongs to? Is it Order or Item?