['template_id', 'field_id'], 'message'=>'Поле уже назначено'], [['field_id'], 'exist', 'skipOnError' => true, 'targetClass' => DocumentField::className(), 'targetAttribute' => ['field_id' => 'id']], [['template_id'], 'exist', 'skipOnError' => true, 'targetClass' => Template::className(), 'targetAttribute' => ['template_id' => 'id']], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'template_id' => 'Шаблон', 'field_id' => 'Поле', ]; } /** * @return \yii\db\ActiveQuery */ public function getField() { return $this->hasOne(DocumentField::className(), ['id' => 'field_id']); } /** * @return \yii\db\ActiveQuery */ public function getTemplate() { return $this->hasOne(Template::className(), ['id' => 'template_id']); } }