芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/xmintal-back/vendor/yiisoft/yii2-debug/src/models/search/User.php
* @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; } }