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 => 'Проект' ]; } /** * @return string status text label */ public function getStatusesText() { return $this->statuses[$this->status_id]; } }