{
"event": "PreToolUse",
"tool_name": "Edit",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Framework\/App.php",
"old_string": " \/**\n * Register core services in the container.\n *\n * Explicit registrations override autowiring.\n * Services without registration will be autowired.\n *\/\n protected function registerServices(): void\n {\n \/\/ Load service definitions if file exists\n $servicesFile = dirname(__DIR__) . '\/services.php';\n if (file_exists($servicesFile)) {\n $configure = require $servicesFile;\n if (is_callable($configure)) {\n $configure($this->container);\n }\n }\n }",
"new_string": " \/**\n * Register core services in the container.\n *\n * Explicit registrations override autowiring.\n * Services without registration will be autowired.\n *\/\n protected function registerServices(): void\n {\n \/\/ Load service definitions if file exists\n $servicesFile = dirname(__DIR__) . '\/services.php';\n if (file_exists($servicesFile)) {\n $configure = require $servicesFile;\n if (is_callable($configure)) {\n $configure($this->container);\n }\n }\n\n \/\/ Eager-load services that use static facades\n $this->initializeEagerServices();\n }\n\n \/**\n * Initialize services that must be loaded before any request handling.\n * Required for static facades like ModelConfig that depend on singletons.\n *\/\n protected function initializeEagerServices(): void\n {\n \/\/ ModelRegistry must be initialized for ModelConfig static methods\n $this->container->get(\\Infrastructure\\AI\\ModelRegistry::class);\n }"
}
}
{
"tool_response": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Framework\/App.php",
"oldString": " \/**\n * Register core services in the container.\n *\n * Explicit registrations override autowiring.\n * Services without registration will be autowired.\n *\/\n protected function registerServices(): void\n {\n \/\/ Load service definitions if file exists\n $servicesFile = dirname(__DIR__) . '\/services.php';\n if (file_exists($servicesFile)) {\n $configure = require $servicesFile;\n if (is_callable($configure)) {\n $configure($this->container);\n }\n }\n }",
"newString": " \/**\n * Register core services in the container.\n *\n * Explicit registrations override autowiring.\n * Services without registration will be autowired.\n *\/\n protected function registerServices(): void\n {\n \/\/ Load service definitions if file exists\n $servicesFile = dirname(__DIR__) . '\/services.php';\n if (file_exists($servicesFile)) {\n $configure = require $servicesFile;\n if (is_callable($configure)) {\n $configure($this->container);\n }\n }\n\n \/\/ Eager-load services that use static facades\n $this->initializeEagerServices();\n }\n\n \/**\n * Initialize services that must be loaded before any request handling.\n * Required for static facades like ModelConfig that depend on singletons.\n *\/\n protected function initializeEagerServices(): void\n {\n \/\/ ModelRegistry must be initialized for ModelConfig static methods\n $this->container->get(\\Infrastructure\\AI\\ModelRegistry::class);\n }",
"originalFile": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Framework;\n\n\/\/ @responsibility: Applikations-Bootstrap und Service-Registrierung\n\nuse Framework\\Middleware\\CorrelationMiddleware;\n\nclass App\n{\n protected Router $router;\n protected Container $container;\n\n public function __construct()\n {\n $this->container = new Container();\n $this->router = new Router();\n $this->router->setContainer($this->container);\n\n \/\/ Register core services\n $this->registerServices();\n }\n\n public function run(): void\n {\n \/\/ Run middleware chain\n $middleware = new CorrelationMiddleware();\n $middleware->handle(fn () => $this->dispatch());\n }\n\n \/**\n * Dispatch the request to the router.\n *\/\n protected function dispatch(): void\n {\n $uri = parse_url($_SERVER['REQUEST_URI'] ?? '\/', PHP_URL_PATH);\n $method = $_SERVER['REQUEST_METHOD'] ?? 'GET';\n\n $this->router->dispatch($uri ?? '\/', $method);\n }\n\n public function router(): Router\n {\n return $this->router;\n }\n\n public function container(): Container\n {\n return $this->container;\n }\n\n \/**\n * Register core services in the container.\n *\n * Explicit registrations override autowiring.\n * Services without registration will be autowired.\n *\/\n protected function registerServices(): void\n {\n \/\/ Load service definitions if file exists\n $servicesFile = dirname(__DIR__) . '\/services.php';\n if (file_exists($servicesFile)) {\n $configure = require $servicesFile;\n if (is_callable($configure)) {\n $configure($this->container);\n }\n }\n }\n}\n",
"structuredPatch": [
{
"oldStart": 67,
"oldLines": 5,
"newStart": 67,
"newLines": 18,
"lines": [
" $configure($this->container);",
" }",
" }",
"+",
"+ \/\/ Eager-load services that use static facades",
"+ $this->initializeEagerServices();",
" }",
"+",
"+ \/**",
"+ * Initialize services that must be loaded before any request handling.",
"+ * Required for static facades like ModelConfig that depend on singletons.",
"+ *\/",
"+ protected function initializeEagerServices(): void",
"+ {",
"+ \/\/ ModelRegistry must be initialized for ModelConfig static methods",
"+ $this->container->get(\\Infrastructure\\AI\\ModelRegistry::class);",
"+ }",
" }"
]
}
],
"userModified": false,
"replaceAll": false
}
}