/
v.bolshakov
/
AIEcosystem-Testing
Обзор
Документация
Войти
/
v.bolshakov
/
AIEcosystem-Testing
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
dev
common/models/LinkRoleDepartment.php
77 строк
2 KB
Developer
Initial commit
03 авг 2026, 17:43
03 авг 2026, 17:43
7433917
Код
Авторство
О чём код?
<?php namespace common\models; use common\models\base\BaseModel; use common\models\base\Model; use Yii; use yii\db\ActiveQuery; use yii\helpers\ArrayHelper; /** * This is the model class for table "link_role_department". * * @property int $department_id * @property int $role_id * * @author Dmitry E. Semenov <sde.tomsk@gmail.com> * @copyright Self (c) 2025 */ class LinkRoleDepartment extends BaseModel { /** * {@inheritdoc} */ public static function tableName() { return 'link_role_department'; } /** * {@inheritdoc} */ public function rules() { return ArrayHelper::merge(parent::rules(), [ [['department_id', 'role_id'], 'number'], [['department_id', 'role_id'], 'required'], [ [ 'department_id', 'role_id' ], 'unique', 'targetAttribute' => ['department_id', 'role_id'] ], ]); } /** * {@inheritdoc} */ public function attributeLabels() { return ArrayHelper::merge(parent::attributeLabels(), [ 'role_id' => Yii::t('app', 'Role'), 'department_id' => Yii::t('app', 'Department'), ]); } /** * @return ActiveQuery */ public function getRole() { return $this->hasOne(AclRole::class, ['id' => 'role_id']); } /** * @return ActiveQuery */ public function getDepartment() { return $this->hasOne(Department::class, ['id' => 'department_id']); } }