100], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'name' => 'Название', 'use' => 'Применение', ]; } /** * @return \yii\db\ActiveQuery */ public function getUseStatuses() { return $this->hasMany(UseStatus::class, ['status_id' => 'id']); } public static function getStatusesArray($type) { return ArrayHelper::map( self::find() ->joinWith('useStatuses') ->where(['`use_status`.`use`' => $type])->all(), 'id', 'name'); } /** * @return \yii\db\ActiveQuery */ public function getUserCards() { return $this->hasMany(UserCard::class, ['status' => 'id']); } public static function getByName($name) { return Status::find()->where(['name' => $name])->one()->id ?? false; } }