Open senguttuvang opened 8 years ago
Since the 'mdm\admin\models\Authitem' is not active record. You cannot do that. Create your own Authitem model
Will I be able to extend your AuthItem class and establish relationship to that? How does it add / modify rows, if it is not ActiveRecord model? Is it framework's core AuthManager library that handles all that?
I had to filter users based on their roles [fortunately, one one role] so I went with join and did that. But, I'm looking for a ORM solution.
I have this code in my User model
`PHP Warning – yii\base\ErrorException
Missing argument 1 for mdm\admin\models\AuthItem::find(), called in /project/vendor/yiisoft/yii2/db/BaseActiveRecord.php on line 383 and defined
in /project/common/models/User.php at line 216 – yii\db\BaseActiveRecord::hasMany('mdm\admin\models\AuthItem', ['name' => 'item_name']) 210211212213214215216217218219220221222 { return $this->getPrimaryKey(); }
public function getRoles() { return $this->hasMany(\mdm\admin\models\AuthItem::className(), ['name' => 'item_name']) ->viaTable('rbac_auth_assignment', ['user_id' => 'id']); }
/**