From 9871c2e707f8b7c77bfa7c1b7c83d7acad19decd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20M=C3=BChl?= Date: Wed, 8 Apr 2026 12:26:17 +0200 Subject: [PATCH] feat: DI extension, services.yaml, and autoloader fix for plugin detection - Add DependencyInjection/KimaiHeatmapExtension to load services.yaml - Register bundle as tagged PluginInterface service so PluginManager finds it - Exclude recursive symlink path from Kimai's autoloader classmap - Bump PHP memory_limit to 1G for Kimai cache warmup Co-Authored-By: Claude Opus 4.6 --- DependencyInjection/KimaiHeatmapExtension.php | 17 +++++++++++++++++ Resources/config/services.yaml | 3 +++ dev/setup.sh | 17 ++++++++++++++++- flake.nix | 2 +- 4 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 DependencyInjection/KimaiHeatmapExtension.php create mode 100644 Resources/config/services.yaml diff --git a/DependencyInjection/KimaiHeatmapExtension.php b/DependencyInjection/KimaiHeatmapExtension.php new file mode 100644 index 0000000..f68dedf --- /dev/null +++ b/DependencyInjection/KimaiHeatmapExtension.php @@ -0,0 +1,17 @@ +load('services.yaml'); + } +} diff --git a/Resources/config/services.yaml b/Resources/config/services.yaml new file mode 100644 index 0000000..123293a --- /dev/null +++ b/Resources/config/services.yaml @@ -0,0 +1,3 @@ +services: + KimaiPlugin\KimaiHeatmapBundle\KimaiHeatmapBundle: + tags: ['App\Plugin\PluginInterface'] diff --git a/dev/setup.sh b/dev/setup.sh index 85a3cf5..847369e 100755 --- a/dev/setup.sh +++ b/dev/setup.sh @@ -61,7 +61,22 @@ echo "==> Symlinking plugin..." mkdir -p var/plugins ln -sfn "$PROJECT_DIR" var/plugins/KimaiHeatmapBundle -# Step 9: Clear cache +# Step 9: Exclude recursive symlink from autoloader classmap +# The plugin symlink points to project root which contains dev/kimai/ creating a loop. +# Tell Composer to skip scanning the dev/ directory inside the plugin symlink. +cd "$KIMAI_DIR" +php -r ' +$f = "composer.json"; +$j = json_decode(file_get_contents($f), true); +$exclude = "var/plugins/KimaiHeatmapBundle/dev/"; +if (!in_array($exclude, $j["autoload"]["exclude-from-classmap"] ?? [])) { + $j["autoload"]["exclude-from-classmap"][] = $exclude; + file_put_contents($f, json_encode($j, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n"); +} +' +composer dump-autoload + +# Step 10: Clear cache bin/console cache:clear # Stop MariaDB diff --git a/flake.nix b/flake.nix index 915666d..2dda84b 100644 --- a/flake.nix +++ b/flake.nix @@ -11,7 +11,7 @@ pkgs = nixpkgs.legacyPackages.${system}; php = pkgs.php82.buildEnv { extensions = { enabled, all }: enabled ++ (with all; [ xsl pdo_mysql ]); - extraConfig = "memory_limit = 512M"; + extraConfig = "memory_limit = 1G"; }; in {