Skip to content

Commit

Permalink
Merge branch '6.13' into 7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
andrerom committed Jun 18, 2018
2 parents 5ccb92f + 09feca1 commit ef98c9d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
32 changes: 32 additions & 0 deletions eZ/Publish/Core/MVC/Exception/HiddenLocationException.php
@@ -0,0 +1,32 @@
<?php

/**
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace eZ\Publish\Core\MVC\Exception;

use eZ\Publish\API\Repository\Values\Content\Location;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

class HiddenLocationException extends NotFoundHttpException
{
/**
* @var \eZ\Publish\API\Repository\Values\Content\Location
*/
private $location;

public function __construct(Location $location, $message = null, \Exception $previous = null, $code = 0)
{
$this->location = $location;
parent::__construct($message, $previous, $code);
}

/**
* @return \eZ\Publish\API\Repository\Values\Content\Location
*/
public function getLocation()
{
return $this->location;
}
}
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit ef98c9d

Please sign in to comment.