Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mrothauer committed Mar 4, 2025
1 parent f7f0972 commit 82a4bb5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/Controller/EventsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -583,9 +583,7 @@ public function ajaxGetAllEventsForMap(): void
}

$categoriesTable = $this->getTableLocator()->get('Categories');
$categoriesMap = $categoriesTable->getMainCategoriesForFrontend()->formatResults(function ($results) {
return $results->indexBy('id');
})->toArray();
$categoriesMap = $categoriesTable->getMainCategoriesForFrontendIndexedById();
$this->set('categoriesMap', $categoriesMap);

foreach($events as $event) {
Expand Down Expand Up @@ -642,9 +640,7 @@ public function all(): void
$this->set('isOnlineEvent', $isOnlineEvent);

$categoriesTable = $this->getTableLocator()->get('Categories');
$categoriesMap = $categoriesTable->getMainCategoriesForFrontend()->formatResults(function ($results) {
return $results->indexBy('id');
})->toArray();
$categoriesMap = $categoriesTable->getMainCategoriesForFrontendIndexedById();
$this->set('categoriesMap', $categoriesMap);

$preparedCategories = [];
Expand Down Expand Up @@ -760,6 +756,7 @@ public function all(): void
$query->where(['Events.is_online_event' => 1]);
}

$query->select($eventsTable->getListFields());
$query->orderBy($eventsTable->getListOrder());
$query->contain([
'Workshops',
Expand Down
7 changes: 7 additions & 0 deletions src/Model/Table/CategoriesTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@ public function getCategoriesForStatisticsGlobal(): array
return $categories;
}

public function getMainCategoriesForFrontendIndexedById(): array
{
return $this->getMainCategoriesForFrontend()->formatResults(function ($results) {
return $results->indexBy('id');
})->toArray();
}

public function getMainCategoriesForFrontend(): SelectQuery
{
$categories = $this->find('all',
Expand Down

0 comments on commit 82a4bb5

Please sign in to comment.