/
v.bolshakov
/
AIEcosystem-Testing
Обзор
Документация
Войти
/
v.bolshakov
/
AIEcosystem-Testing
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
dev
common/models/UserQuery.php
63 строки
1 KB
Developer
Initial commit
03 авг 2026, 17:43
03 авг 2026, 17:43
7433917
Код
Авторство
О чём код?
<?php namespace common\models; use common\helpers\Utf8Helper; use common\models\base\BaseQuery; /** * This is the model class for table "user". * * @author Dmitry E. Semenov <sde.tomsk@gmail.com> * @copyright Self (c) 2020-2022 */ class UserQuery extends BaseQuery { /** * Получить пользователей клиента * @param $client_id * @return UserQuery */ public function prepareClient($client_id) { $a = $this->alias; return $this ->alias($a) ->innerJoin(['cu' => ClientUser::tableName()], $a . '.id = cu.user_id') ->andWhere([ 'cu.client_id' => $client_id ]); } /** * Без лицензии * @return UserQuery */ public function prepareWithOutLicense() { $a = $this->alias; return $this ->alias($a) ->leftJoin(['ul' => UserLicense::tableName()], $a . '.id = ul.user_id') ->andWhere([ 'ul.license_id' => null ]); } /** * Заготовка для поиска пользователя * * @param string $username Имя пользователя * @return UserQuery */ public function prepareFind($username) { $username = Utf8Helper::strtolower($username); return $this->andWhere([ 'lower(username)' => $username ]); } }