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,27 +110,29 @@ | ||
| 110 | 110 | ||
| 111 | public function actionIndividual() | 111 | public function actionIndividual() |
| 112 | { | 112 | { |
| 113 | + $idsArray = [ | ||
| 114 | + 25, | ||
| 115 | + 37, | ||
| 116 | + 12, | ||
| 117 | + 42, | ||
| 118 | + ]; | ||
| 113 | 119 | ||
| 114 | $objects = Objectkb::find() | 120 | $objects = Objectkb::find() |
| 115 | ->with('lang.alias') | 121 | ->with('lang.alias') |
| 116 | ->where( | 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 | ->all(); | 128 | ->all(); |
| 128 | 129 | ||
| 129 | return $this->render( | 130 | return $this->render( |
| 130 | 'individual', | 131 | 'individual', |
| 131 | [ | 132 | [ |
| 132 | 'objects' => $objects, | 133 | 'objects' => $objects, |
| 133 | - ] | 134 | + 'idsArray' => $idsArray, |
| 135 | + ] | ||
| 134 | ); | 136 | ); |
| 135 | } // частное лицо | 137 | } // частное лицо |
| 136 | 138 |
frontend/views/site/individual.php
| @@ -5,6 +5,7 @@ | @@ -5,6 +5,7 @@ | ||
| 5 | * @var Feedback $contact | 5 | * @var Feedback $contact |
| 6 | * @var SeoComponent $seo | 6 | * @var SeoComponent $seo |
| 7 | * @var Objectkb[] $objects | 7 | * @var Objectkb[] $objects |
| 8 | + * @var array $idsArray | ||
| 8 | */ | 9 | */ |
| 9 | 10 | ||
| 10 | use artbox\core\components\SeoComponent; | 11 | use artbox\core\components\SeoComponent; |
| @@ -207,7 +208,8 @@ | @@ -207,7 +208,8 @@ | ||
| 207 | <div class="row portfolio"> | 208 | <div class="row portfolio"> |
| 208 | <?php | 209 | <?php |
| 209 | if (!empty($objects)) { | 210 | if (!empty($objects)) { |
| 210 | - foreach ($objects as $object) { | 211 | + foreach ($idsArray as $id) { |
| 212 | + $object = $objects[$id]; | ||
| 211 | ?> | 213 | ?> |
| 212 | <div class="col-sm-6"> | 214 | <div class="col-sm-6"> |
| 213 | <div class="box-image"> | 215 | <div class="box-image"> |