true, 'targetClass' => AdditionalFields::class, 'targetAttribute' => ['field_id' => 'id']], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'field_id' => 'Поле', 'use' => 'Применение', ]; } /** * @return \yii\db\ActiveQuery */ public function getField() { return $this->hasOne(AdditionalFields::className(), ['id' => 'field_id']); } public function getStatuses() { return [ self::USE_PROFILE => 'Профиль', self::USE_PROJECT => 'Проект', self::USE_COMPANY => 'Компания', self::USE_BALANCE => 'Баланс', self::USE_NOTE => 'Заметка' ]; } /** * @return string status text label */ public function getStatusesText() { return $this->statuses[$this->status_id]; } /** * @return string status text label */ public static function getStatusesTextById($id) { $model = new self(); return $model->statuses[$id]; } }