/
v.bolshakov
/
AIEcosystem-Testing
Обзор
Документация
Войти
/
v.bolshakov
/
AIEcosystem-Testing
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
dev
common/models/Acl.php
95 строк
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 "acl". * * @property int $user_id User * @property int $role_id Role * * @property AclRole $role * @property User $user * * @author Dmitry E. Semenov <sde.tomsk@gmail.com> * @copyright Self (c) 2020 */ class Acl extends BaseModel { /** * {@inheritdoc} */ public static function tableName() { return 'acl'; } /** * {@inheritdoc} */ public function rules() { return ArrayHelper::merge(parent::rules(), [ [['user_id', 'role_id'], 'required'], [['user_id', 'role_id'], 'integer'], [ [ 'user_id', 'role_id' ], 'unique', 'targetAttribute' => ['user_id', 'role_id'] ], [ ['role_id'], 'exist', 'skipOnError' => true, 'targetClass' => AclRole::class, 'targetAttribute' => ['role_id' => 'id'] ], [ ['user_id'], 'exist', 'skipOnError' => true, 'targetClass' => User::class, 'targetAttribute' => ['user_id' => 'id'] ], ]); } /** * {@inheritdoc} */ public function attributeLabels() { return ArrayHelper::merge(parent::attributeLabels(), [ 'user_id' => Yii::t('app', 'User'), 'role_id' => Yii::t('app', 'Role'), ]); } /** * Gets query for [[Role]]. * * @return ActiveQuery */ public function getRole() { return $this->hasOne(AclRole::class, ['id' => 'role_id']); } /** * Gets query for [[User]]. * * @return ActiveQuery */ public function getUser() { return $this->hasOne(User::class, ['id' => 'user_id']); } }