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