Error When Create New Role or Permission
bahirul opened this issue · comments
Get this error whene create new role or permission :
TypeError
Argument 1 passed to yii2mod\rbac\models\AuthItemModel::find() must be of the type string, none given, called in /var/www/html/payroll-ns/vendor/yiisoft/yii2/validators/UniqueValidator.php on line 210
I think the problem is unique function in AuthItemModel.
You use unique validator, but unique ini yii2 use built ini yii2/validators/UniqueValidator.php.
It will be better renaming custom validation function, uniqueRole as example.
Hi, thanks, I will check it.
I fixed this issue, please update your package.
Hi @igor-chepurnoi, thanks for fixing this issue.
Hi @igor-chepurnoi, I have similar issue, but to me it returns the next error:
Call to undefined method yii2mod\rbac\models\AuthItemModel::getDb()
in /var/www/DST-tool/vendor/yiisoft/yii2/validators/UniqueValidator.php at line 139
foreach ($rawConditions as $key => $value) {
if (is_array($value)) {
$this->addError($model, $attribute, Yii::t('yii', '{attribute} is invalid.'));
return;
}
$conditions[] = [$key => $value];
}
$db = $targetClass::getDb(); ****this line is the problem
......
Edit: Sorry, the problem is because when i install module through composer, it is not install the last version of module.