'@' . RequestHandler::class, '$middlewares' => '@frontend.middlewares', ], )] RequestHandlerInterface $requestHandler, protected readonly Context $context, ) { $this->requestHandler = $requestHandler; } public function handle(ServerRequestInterface $request): ResponseInterface { // Create new request object having applicationType "I am a frontend request" attribute. $request = $request->withAttribute('applicationType', SystemEnvironmentBuilder::REQUESTTYPE_FE); $this->initializeContext(); return parent::handle($request); } /** * Initializes the Context used for accessing data and finding out the current state of the application */ protected function initializeContext(): void { $this->context->setAspect('date', new DateTimeAspect(DateTimeFactory::createFromTimestamp($GLOBALS['EXEC_TIME']))); $this->context->setAspect('visibility', new VisibilityAspect()); $this->context->setAspect('workspace', new WorkspaceAspect(0)); $this->context->setAspect('backend.user', new UserAspect(null)); $this->context->setAspect('frontend.user', new UserAspect(null, [0, -1])); } }