ControllerInfo example

'themeId' => $themeId,
            'controllerName' => (string) $controllerInfo->getName(),
            'controllerAction' => (string) $controllerInfo->getAction(),
            'context' => $context,
            'activeRoute' => $request->attributes->get('_route'),
            'formViolations' => $request->attributes->get('formViolations'),
        ];
    }

    private function getControllerInfo(Request $request): ControllerInfo
    {
        $controllerInfo = new ControllerInfo();
        $controller = $request->attributes->get('_controller');

        if (!$controller) {
            return $controllerInfo;
        }

        $matches = [];
        preg_match('/Controller\\\\(\w+)Controller::?(\w+)$/', (string) $controller$matches);

        if ($matches) {
            $controllerInfo->setName($matches[1]);
            
Home | Imprint | This part of the site doesn't use cookies.