@@ -67,16 +67,16 @@ 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 ActiveRecordInterface|SearchInterface $ar */ |
72 | 72 | $ar = Yii::createObject($model['class']); |
73 | 73 | |
74 | - if($ar instanceof SearchInterface && $ar instanceof ActiveRecordInterface) { |
|
74 | + if ($ar instanceof SearchInterface && $ar instanceof ActiveRecordInterface) { |
|
75 | 75 | $searchFields = $ar->getSearchFields(); |
76 | 76 | $dbQuery = $ar::find(); |
77 | 77 | |
78 | - foreach($searchFields as $field) { |
|
79 | - if($ar->hasAttribute($field)) { |
|
78 | + foreach ($searchFields as $field) { |
|
79 | + if ($ar->hasAttribute($field)) { |
|
80 | 80 | $dbQuery->orWhere(['like', $field, $query]); |
81 | 81 | } else { |
82 | 82 | $message = sprintf("Field `%s` not found in `%s` model", $field, $ar); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | $modelObjects = $dbQuery->all(); |
88 | - if($modelObjects !== null) { |
|
88 | + if ($modelObjects !== null) { |
|
89 | 89 | $this->_currentModel = $ar; |
90 | 90 | $this->addToResult($modelObjects); |
91 | 91 | } |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function getModelLabel($modelName) |
109 | 109 | { |
110 | - foreach($this->models as $model) { |
|
111 | - if($model['class'] == $modelName) { |
|
110 | + foreach ($this->models as $model) { |
|
111 | + if ($model['class'] == $modelName) { |
|
112 | 112 | return $model['label']; |
113 | 113 | } |
114 | 114 | } |
@@ -93,7 +93,7 @@ |
||
93 | 93 | public static function sortByModel(array $searchResults) |
94 | 94 | { |
95 | 95 | $sorted = []; |
96 | - foreach($searchResults as $obj) { |
|
96 | + foreach ($searchResults as $obj) { |
|
97 | 97 | $sorted[$obj->modelName][] = $obj; |
98 | 98 | } |
99 | 99 |