@@ -67,15 +67,15 @@ discard block |
||
| 67 | 67 | * @throws InvalidConfigException |
| 68 | 68 | */ |
| 69 | 69 | public function search($query) { |
| 70 | - foreach($this->models as $model) { |
|
| 70 | + foreach ($this->models as $model) { |
|
| 71 | 71 | /* @var BaseActiveRecord|SearchInterface $searchModel */ |
| 72 | 72 | $searchModel = Yii::createObject($model['class']); |
| 73 | 73 | |
| 74 | - if($this->isSearchModel($searchModel)) { |
|
| 74 | + if ($this->isSearchModel($searchModel)) { |
|
| 75 | 75 | $activeQuery = $searchModel::find(); |
| 76 | 76 | |
| 77 | - foreach($searchModel->getSearchFields() as $field) { |
|
| 78 | - if($searchModel->hasAttribute($field)) { |
|
| 77 | + foreach ($searchModel->getSearchFields() as $field) { |
|
| 78 | + if ($searchModel->hasAttribute($field)) { |
|
| 79 | 79 | $activeQuery->orWhere(['like', $field, $query]); |
| 80 | 80 | } else { |
| 81 | 81 | throw new \Exception(sprintf("Field `%s` not found in `%s` model", $field, $model['class'])); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $foundModels = $activeQuery->all(); |
| 86 | - if($foundModels !== null) { |
|
| 86 | + if ($foundModels !== null) { |
|
| 87 | 87 | $this->_currentModel = $searchModel; |
| 88 | 88 | $this->addToResult($foundModels); |
| 89 | 89 | } |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | public function getModelLabel($modelName) |
| 107 | 107 | { |
| 108 | - foreach($this->models as $model) { |
|
| 109 | - if($model['class'] == $modelName) { |
|
| 108 | + foreach ($this->models as $model) { |
|
| 109 | + if ($model['class'] == $modelName) { |
|
| 110 | 110 | return $model['label']; |
| 111 | 111 | } |
| 112 | 112 | } |