CRUD

I have been creating models and cruds without any issues. However i have just started using foreign keys and now i get a fatal error.

I do the following

  1. I create a model

  2. I change nothing

  3. I create a class.

I then get this error

[color=#E51717][font=inherit][size=2]PHP Fatal Error[/size][/font][/color] – yii\base\ErrorException

Class ‘common\models\jobs\ActionsGroups’ not found

I can resolve this error by uncommenting the class call in the rules. As below. But am i doing something wrong or should i do that when i am creating models and cruds

[color=#000080]public function [/color]rules()

{

[color=#000080][b]return [/b][/color][


    [[[color=#008000][b]'user_id'[/b][/color], [color=#008000][b]'task_group_id'[/b][/color], [color=#008000][b]'hide'[/b][/color]], [color=#008000][b]'integer'[/b][/color]],


    [[[color=#008000][b]'date'[/b][/color], [color=#008000][b]'time'[/b][/color], [color=#008000][b]'pre_time'[/b][/color], [color=#008000][b]'post_time'[/b][/color], [color=#008000][b]'date_added'[/b][/color], [color=#008000][b]'date_updated'[/b][/color]], [color=#008000][b]'safe'[/b][/color]],


    ......	[[[color=#008000][b]'bug'[/b][/color]], [color=#008000][b]'string'[/b][/color], [color=#008000][b]'max' [/b][/color]=> [color=#0000ff]25[/color]],


   [color=#808080][i]// [['action_group_id'], 'exist', 'skipOnError' => true, 'targetClass' => ActionsGroups::className(), 'targetAttribute' => ['action_group_id' => 'id']],

[/i][/color][color=#808080][i] // [[‘contractor_id’], ‘exist’, ‘skipOnError’ => true, ‘targetClass’ => Locations::className(), ‘targetAttribute’ => [‘contractor_id’ => ‘id’]],

[/i][/color][color=#808080][i] // [[‘location_id’], ‘exist’, ‘skipOnError’ => true, ‘targetClass’ => Locations::className(), ‘targetAttribute’ => [‘location_id’ => ‘id’]],

[/i][/color][color=#808080][i] // [[‘schedule_id’], ‘exist’, ‘skipOnError’ => true, ‘targetClass’ => ScheduleTask::className(), ‘targetAttribute’ => [‘schedule_id’ => ‘id’]],

[/i][/color][color=#808080][i] // [[‘task_group_id’], ‘exist’, ‘skipOnError’ => true, ‘targetClass’ => ScheduleTaskGroup::className(), ‘targetAttribute’ => [‘task_group_id’ => ‘id’]],

[/i][/color][color=#808080] [/color]];

}

I guess that in class you have also on top of it:

use common\models\jobs\ActionsGroups;

?

But do you have class ActionsGroups before creating that new one with CRUD?