所以我想實現一個好友列表,上面是我爲我的簡單項目和生成模型後所做的SQL圖。我意識到Gii生成模型的方式出了問題。 我想,利用用戶對自身的許多一對多的關係,但是這是我的了: class User {
...
public function getPosts()
{
return $this->hasMany(Post::className(), ['userId
這裏ActiveRecord的相關車型表結構: Table BaseTable
id (primary key) INT
description VARCHAR(255)
Table ChildTable
id (primary key)(foreign key reference to BaseTable) INT
child_property VAR