Unique validator

Hi,

I am using the unique validator like so …




["profileSkillName", "unique", "targetClass" => "Skill", "targetAttribute" => "name"]



The model which I am declaring the validation is in the app\models namespace.

The Skill model is in the app\models namespace.

I have tried putting "use app\models\Skill" in the model I am declaring the validation in.

And it is giving me the following error …

exception ‘yii\base\ErrorException’ with message ‘Class ‘Skill’ not found’ in /home/mutabl3/public_html/jamesbarnsley.com/showcase/vendor/yiisoft/yii2/validators/UniqueValidator.php:100 Stack trace: #0 [internal function]: yii\base\ErrorHandler->handleFatalError() #1 {main}

Hi,

It is OK, needed to declare like so …




["profileSkillName", "unique", "targetClass" => "app\models\Skill", "targetAttribute" => "name"]



Needed to add "app\models\" in the targetClass.