255], ['field_id', 'unique', 'targetAttribute' => ['field_id', 'document_id'], 'message'=>'Поле уже используется'], [['document_id'], 'exist', 'skipOnError' => true, 'targetClass' => Document::className(), 'targetAttribute' => ['document_id' => 'id']], [['field_id'], 'exist', 'skipOnError' => true, 'targetClass' => DocumentField::className(), 'targetAttribute' => ['field_id' => 'id']], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'field_id' => 'Поле', 'document_id' => 'Документ', 'value' => 'Значение', ]; } /** * @return \yii\db\ActiveQuery */ public function getDocument() { return $this->hasOne(Document::className(), ['id' => 'document_id']); } /** * @return \yii\db\ActiveQuery */ public function getField() { return $this->hasOne(DocumentField::className(), ['id' => 'field_id']); } }