true, 'targetClass' => Status::class, 'targetAttribute' => ['status_id' => 'id']], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'status_id' => 'Статус', 'use' => 'Применение', ]; } /** * @return \yii\db\ActiveQuery */ public function getStatus() { return $this->hasOne(Status::class, ['id' => 'status_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 static function getStatusesText($id) { $model = new self(); return $model->statuses[$id]; } }