$array = [
[
'id' => '100', //допустим, id
'name' => 'Фрукты', //Название
'sub_category' => [
'id' => '101',
'name' => 'Цитрусовые',
'product' => [
[
'id' => '102',
'name' => 'Апельсин'
],
[
'id' => '103',
'name' => 'Мандарин',
]
]
]
],
[
'id' => '103',
'name' => 'Овощи',
'sub_category' => [
'id' => '104',
'name' => 'Корнеплоды',
'product' => [
[
'id' => '105',
'name' => 'Картофель'
],
[
'id' => '106',
'name' => 'Морковь',
]
]
]
],
];
$iterator = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($array));
$names = [];
foreach ($iterator as $name) {
$depth = floor($iterator->getDepth()/2);
$names[$depth] = $name;
echo implode(' > ', array_slice($names, 0, $depth + 1)), '<br>', PHP_EOL;
}
return (new ViewModel())
->setVariables($productsView->getItemsVariables())
;
<?php $caritem = ["car__item_left", "car__item_left-bottom", "car__item_middle", "car__item_middle-bottom"]; ?>
<div class="car__items">
<?php foreach($caritem as $key1 => $value): ?>
<?php foreach ($arResult['ITEMS'] as $key2 => $arItem): ?>
<div class="<?= 'car__item' . $value ?>">
<div class="car__button"></div>
<div class="car__hover car__hover_mobile">
<h3 class="car__title"><?= $arItem['NAME'] ?></h3>
<div class="car__text">
<p><?= $arItem['PREVIEW_TEXT'] ?></p>
</div>
<a class="link link_car" href="<?= $arItem['DETAIL_PAGE_URL']?>">Подробнее</a>
</div>
</div>
<?php endforeach ?>
<?php endforeach ?>
</div>
/**
* Включаем автозагрузку классов в PHP с использованием SPL.
*/
spl_autoload_extensions('.php');
spl_autoload_register();
It is not possible to use join columns pointing to non-primary keys. Doctrine will think these are the primary keys and create lazy-loading proxies with the data, which can lead to unexpected results. Doctrine can for performance reasons not validate the correctness of this settings at runtime but only through the Validate Schema command.