true, 'targetClass' => Project::className(), 'targetAttribute' => ['project_id' => 'id']], [['user_id'], 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['user_id' => 'id']], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'project_id' => 'Проект', 'user_id' => 'Сотрудник', ]; } /** * @return \yii\db\ActiveQuery */ public function getProject() { return $this->hasOne(Project::className(), ['id' => 'project_id']); } /** * @return \yii\db\ActiveQuery */ public function getUser() { return $this->hasOne(User::className(), ['id' => 'user_id']); } /** * @return \yii\db\ActiveQuery */ public function getTasks() { return $this->hasMany(Task::className(), ['project_user_id' => 'id']); } /** * @return \yii\db\ActiveQuery */ public function getTaskUsers() { return $this->hasMany(TaskUser::className(), ['project_user_id' => 'id']); } }