|
|
@@ -6,6 +6,8 @@ use Opentalent\OtCore\Website\OtPageRepository;
|
|
|
use Opentalent\OtCore\Website\OtWebsiteRepository;
|
|
|
use Psr\Http\Message\ResponseInterface;
|
|
|
use Psr\Http\Message\ServerRequestInterface;
|
|
|
+use TYPO3\CMS\Core\Database\ConnectionPool;
|
|
|
+use TYPO3\CMS\Core\Domain\Repository\PageRepository;
|
|
|
use TYPO3\CMS\Core\Error\PageErrorHandler\PageContentErrorHandler;
|
|
|
use TYPO3\CMS\Core\Error\PageErrorHandler\PageErrorHandlerInterface;
|
|
|
use TYPO3\CMS\Core\Http\HtmlResponse;
|
|
|
@@ -46,7 +48,6 @@ class ErrorHandler implements PageErrorHandlerInterface
|
|
|
|
|
|
private OtWebsiteRepository $otWebsiteRepository;
|
|
|
private OtPageRepository $otPageRepository;
|
|
|
- private ControllerContext $controllerContext;
|
|
|
private RenderingContext $renderingContext;
|
|
|
private Request $request;
|
|
|
|
|
|
@@ -79,14 +80,6 @@ class ErrorHandler implements PageErrorHandlerInterface
|
|
|
$this->otPageRepository = $otPageRepository;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @param ControllerContext $controllerContext
|
|
|
- * @return void
|
|
|
- */
|
|
|
- public function injectControllerContext(ControllerContext $controllerContext) {
|
|
|
- $this->controllerContext = $controllerContext;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* @param RenderingContext $renderingContext
|
|
|
* @return void
|
|
|
@@ -114,9 +107,23 @@ class ErrorHandler implements PageErrorHandlerInterface
|
|
|
string $message,
|
|
|
array $reasons = []
|
|
|
): ResponseInterface {
|
|
|
- $this->request->setControllerExtensionName('ot_templating');
|
|
|
- $this->controllerContext->setRequest($this->request);
|
|
|
- $this->renderingContext->setControllerContext($this->controllerContext);
|
|
|
+
|
|
|
+ $this->otWebsiteRepository = GeneralUtility::makeInstance(OtWebsiteRepository::class);
|
|
|
+ $this->otPageRepository = GeneralUtility::makeInstance(OtPageRepository::class);
|
|
|
+
|
|
|
+ $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
|
|
|
+ $this->otWebsiteRepository->injectConnectionPool($connectionPool);
|
|
|
+
|
|
|
+ $pageRepository = GeneralUtility::makeInstance(PageRepository::class);
|
|
|
+ $this->otPageRepository->injectPageRepository($pageRepository);
|
|
|
+ $this->otPageRepository->injectConnectionPool($connectionPool);
|
|
|
+
|
|
|
+ $this->request = GeneralUtility::makeInstance(Request::class);
|
|
|
+
|
|
|
+ $this->renderingContext = GeneralUtility::makeInstance(RenderingContext::class);
|
|
|
+
|
|
|
+// $this->request->setControllerExtensionName('ot_templating');
|
|
|
+ $this->renderingContext->setRequest($this->request);
|
|
|
|
|
|
$this->view->setRenderingContext($this->renderingContext);
|
|
|
$this->view->setTemplateRootPaths([self::TEMPLATES_ROOT_PATHS]);
|