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