/
v.bolshakov
/
AIEcosystem-Testing
Обзор
Документация
Войти
/
v.bolshakov
/
AIEcosystem-Testing
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
dev
common/models/Department.php
77 строк
2 KB
Developer
Initial commit
03 авг 2026, 17:43
03 авг 2026, 17:43
7433917
Код
Авторство
О чём код?
<?php namespace common\models; use common\interfaces\TitleInterface; use common\models\base\BaseModel; use common\models\base\Model; use common\traits\TitleRecordTrait; use Yii; use yii\base\InvalidConfigException; use yii\db\ActiveQuery; use yii\helpers\ArrayHelper; /** * This is the model class for table "department". * * @property string $title * @property int $rec_status */ class Department extends BaseModel implements TitleInterface { use TitleRecordTrait; /** * @inheritdoc */ public $softDelete = true; /** * {@inheritdoc} */ public static function tableName() { return 'department'; } /** * {@inheritdoc} */ public function rules() { return ArrayHelper::merge(parent::rules(), [ [['title'], 'string', 'max' => 255], [['title'], 'required'], [['title'], 'filter', 'filter' => 'trim', 'skipOnArray' => true], [['title'], 'unique'], ]); } /** * {@inheritdoc} */ public function attributeLabels() { return ArrayHelper::merge(parent::attributeLabels(), [ 'title' => Yii::t('app', 'Department name'), ]); } /** * @return ActiveQuery * @throws InvalidConfigException */ public function getRole() { return $this->hasMany(AclRole::class, ['id' => 'role_id']) ->viaTable(LinkRoleDepartment::tableName(), ['department_id' => 'id']); } /** * @inheritdoc */ public function __toString() { return $this->title; } }