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 <noreply@anthropic.com>
This commit is contained in:
parent
b0423f2348
commit
9871c2e707
4 changed files with 37 additions and 2 deletions
17
DependencyInjection/KimaiHeatmapExtension.php
Normal file
17
DependencyInjection/KimaiHeatmapExtension.php
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace KimaiPlugin\KimaiHeatmapBundle\DependencyInjection;
|
||||||
|
|
||||||
|
use Symfony\Component\Config\FileLocator;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||||
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||||
|
|
||||||
|
class KimaiHeatmapExtension extends Extension
|
||||||
|
{
|
||||||
|
public function load(array $configs, ContainerBuilder $container): void
|
||||||
|
{
|
||||||
|
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
|
||||||
|
$loader->load('services.yaml');
|
||||||
|
}
|
||||||
|
}
|
||||||
3
Resources/config/services.yaml
Normal file
3
Resources/config/services.yaml
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
services:
|
||||||
|
KimaiPlugin\KimaiHeatmapBundle\KimaiHeatmapBundle:
|
||||||
|
tags: ['App\Plugin\PluginInterface']
|
||||||
17
dev/setup.sh
17
dev/setup.sh
|
|
@ -61,7 +61,22 @@ echo "==> Symlinking plugin..."
|
||||||
mkdir -p var/plugins
|
mkdir -p var/plugins
|
||||||
ln -sfn "$PROJECT_DIR" var/plugins/KimaiHeatmapBundle
|
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
|
bin/console cache:clear
|
||||||
|
|
||||||
# Stop MariaDB
|
# Stop MariaDB
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
php = pkgs.php82.buildEnv {
|
php = pkgs.php82.buildEnv {
|
||||||
extensions = { enabled, all }: enabled ++ (with all; [ xsl pdo_mysql ]);
|
extensions = { enabled, all }: enabled ++ (with all; [ xsl pdo_mysql ]);
|
||||||
extraConfig = "memory_limit = 512M";
|
extraConfig = "memory_limit = 1G";
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue