Skip to content

Commit

Permalink
Update constant used to define the HTTP code
Browse files Browse the repository at this point in the history
  • Loading branch information
Quetzacoalt91 committed Jan 13, 2025
1 parent 0a8897f commit e3b67ab
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions controllers/admin/self-managed/Error404Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,22 @@

class Error404Controller extends AbstractPageController
{
const ERROR_CODE = 404;

public function index()
{
$response = parent::index();

if ($response instanceof Response) {
$response->setStatusCode(self::ERROR_CODE);
$response->setStatusCode(Response::HTTP_NOT_FOUND);
} else {
http_response_code(self::ERROR_CODE);
http_response_code(Response::HTTP_NOT_FOUND);
}

return $response;
}

protected function getPageTemplate(): string
{
return 'errors/' . self::ERROR_CODE;
return 'errors/' . Response::HTTP_NOT_FOUND;
}

protected function getParams(): array
Expand All @@ -58,7 +56,7 @@ protected function getParams(): array
// TODO: assets_base_path is provided by all controllers. What about a asset() twig function instead?
'assets_base_path' => $this->upgradeContainer->getAssetsEnvironment()->getAssetsBaseUrl($this->request),

'error_code' => self::ERROR_CODE,
'error_code' => Response::HTTP_NOT_FOUND,

'exit_to_shop_admin' => $this->upgradeContainer->getUrlGenerator()->getShopAdminAbsolutePathFromRequest($this->request),
'exit_to_app_home' => Routes::HOME_PAGE,
Expand Down

0 comments on commit e3b67ab

Please sign in to comment.