$page = ErrorPage::
createFrom($page);
/** @var CmsPageCollection $pages */
$pages =
$this->cmsPageLoader->
load($request,
new Criteria([$cmsErrorLayoutId]),
$context)->
getEntities();
if (!
$pages->
has($cmsErrorLayoutId)) { throw new PageNotFoundException($cmsErrorLayoutId);
} $page->
setCmsPage($pages->
get($cmsErrorLayoutId));
$this->eventDispatcher->
dispatch(new ErrorPageLoadedEvent($page,
$context,
$request));
return $page;
}}