Commit bb7c6ffc03f9e3f900a2975a0514d49e2ef64e6a
1 parent
316a9003
правки
Showing
2 changed files
with
13 additions
and
9 deletions
Show diff stats
frontend/controllers/SiteController.php
| ... | ... | @@ -110,27 +110,29 @@ |
| 110 | 110 | |
| 111 | 111 | public function actionIndividual() |
| 112 | 112 | { |
| 113 | + $idsArray = [ | |
| 114 | + 25, | |
| 115 | + 37, | |
| 116 | + 12, | |
| 117 | + 42, | |
| 118 | + ]; | |
| 113 | 119 | |
| 114 | 120 | $objects = Objectkb::find() |
| 115 | 121 | ->with('lang.alias') |
| 116 | 122 | ->where( |
| 117 | 123 | [ |
| 118 | - 'id' => [ | |
| 119 | - 25, | |
| 120 | - 37, | |
| 121 | - 38, | |
| 122 | - 39, | |
| 123 | - ], | |
| 124 | + 'id' => $idsArray, | |
| 124 | 125 | ] |
| 125 | 126 | ) |
| 126 | - ->orderBy('id') | |
| 127 | + ->indexBy('id') | |
| 127 | 128 | ->all(); |
| 128 | 129 | |
| 129 | 130 | return $this->render( |
| 130 | 131 | 'individual', |
| 131 | 132 | [ |
| 132 | 133 | 'objects' => $objects, |
| 133 | - ] | |
| 134 | + 'idsArray' => $idsArray, | |
| 135 | + ] | |
| 134 | 136 | ); |
| 135 | 137 | } // частное лицо |
| 136 | 138 | ... | ... |
frontend/views/site/individual.php
| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | * @var Feedback $contact |
| 6 | 6 | * @var SeoComponent $seo |
| 7 | 7 | * @var Objectkb[] $objects |
| 8 | + * @var array $idsArray | |
| 8 | 9 | */ |
| 9 | 10 | |
| 10 | 11 | use artbox\core\components\SeoComponent; |
| ... | ... | @@ -207,7 +208,8 @@ |
| 207 | 208 | <div class="row portfolio"> |
| 208 | 209 | <?php |
| 209 | 210 | if (!empty($objects)) { |
| 210 | - foreach ($objects as $object) { | |
| 211 | + foreach ($idsArray as $id) { | |
| 212 | + $object = $objects[$id]; | |
| 211 | 213 | ?> |
| 212 | 214 | <div class="col-sm-6"> |
| 213 | 215 | <div class="box-image"> | ... | ... |