diff --git a/eZ/Publish/Core/MVC/Exception/HiddenLocationException.php b/eZ/Publish/Core/MVC/Exception/HiddenLocationException.php new file mode 100644 index 00000000000..6ddbfdbf506 --- /dev/null +++ b/eZ/Publish/Core/MVC/Exception/HiddenLocationException.php @@ -0,0 +1,32 @@ +location = $location; + parent::__construct($message, $previous, $code); + } + + /** + * @return \eZ\Publish\API\Repository\Values\Content\Location + */ + public function getLocation() + { + return $this->location; + } +} diff --git a/eZ/Publish/Core/MVC/Symfony/View/Builder/ContentViewBuilder.php b/eZ/Publish/Core/MVC/Symfony/View/Builder/ContentViewBuilder.php index 3dfb3ad238a..63a179ed5de 100644 --- a/eZ/Publish/Core/MVC/Symfony/View/Builder/ContentViewBuilder.php +++ b/eZ/Publish/Core/MVC/Symfony/View/Builder/ContentViewBuilder.php @@ -13,13 +13,13 @@ use eZ\Publish\Core\Base\Exceptions\InvalidArgumentException; use eZ\Publish\Core\Base\Exceptions\UnauthorizedException; use eZ\Publish\Core\Helper\ContentInfoLocationLoader; +use eZ\Publish\Core\MVC\Exception\HiddenLocationException; use eZ\Publish\Core\MVC\Symfony\View\Configurator; use eZ\Publish\Core\MVC\Symfony\View\ContentView; use eZ\Publish\Core\MVC\Symfony\Security\Authorization\Attribute as AuthorizationAttribute; use eZ\Publish\Core\MVC\Symfony\View\EmbedView; use eZ\Publish\Core\MVC\Symfony\View\ParametersInjector; use Symfony\Component\HttpKernel\Controller\ControllerReference; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; /** @@ -211,7 +211,7 @@ function (Repository $repository) use ($locationId) { } ); if ($location->invisible) { - throw new NotFoundHttpException('Location cannot be displayed as it is flagged as invisible.'); + throw new HiddenLocationException($location, 'Location cannot be displayed as it is flagged as invisible.'); } return $location;