Skip to content

Commit

Permalink
Cast locationId and contentId to integer
Browse files Browse the repository at this point in the history
It turns out they can end up as strings when supplied to route config via container parameters
  • Loading branch information
emodric authored and pspanja committed Nov 7, 2023
1 parent 70a7842 commit 449f294
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bundle/View/Builder/ContentViewBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function buildView(array $parameters): ContentView
}

if (isset($parameters['locationId'])) {
$location = $this->loadLocation($parameters['locationId']);
$location = $this->loadLocation((int) $parameters['locationId']);
} elseif (isset($parameters['location'])) {
$location = $parameters['location'];
if ($location instanceof APILocation) {
Expand All @@ -76,7 +76,7 @@ public function buildView(array $parameters): ContentView
}
} else {
if (isset($parameters['contentId'])) {
$contentId = $parameters['contentId'];
$contentId = (int) $parameters['contentId'];
} elseif (isset($location)) {
$contentId = $location->contentInfo->id;
} else {
Expand Down

0 comments on commit 449f294

Please sign in to comment.