public function viewLocation($locationId, $viewType, $layout = false, array $params = array())
{
trigger_error("ViewController::viewLocation() is deprecated since kernel 6.0.0, and will be removed in the future.\n" . 'Use ViewController::viewAction() instead.', E_USER_DEPRECATED);
$this->performAccessChecks();
$response = $this->buildResponse();
try {
if (isset($params['location']) && $params['location'] instanceof Location) {
$location = $params['location'];
} else {
$location = $this->getRepository()->getLocationService()->loadLocation($locationId);
if ($location->invisible) {
throw new NotFoundHttpException("Location #{$locationId} cannot be displayed as it is flagged as invisible.");
}
}
$response->headers->set('X-Location-Id', $locationId);
$response->setContent($this->renderLocation($location, $viewType, $layout, $params));
return $response;
} catch (UnauthorizedException $e) {
throw new AccessDeniedException();
} catch (NotFoundException $e) {
throw new NotFoundHttpException($e->getMessage(), $e);
} catch (NotFoundHttpException $e) {
throw $e;
} catch (Exception $e) {
return $this->handleViewException($response, $params, $e, $viewType, null, $locationId);
}
}