- getHourlyAggregation with timezone-correct CONVERT_TZ - getDayHourAggregation with weekStart-relative day index - getUserCustomers and getUserActivities cascade queries - activity/customer filter params on getDailyAggregation - Inject EntityManagerInterface for testable DBAL access
30 lines
1.2 KiB
PHP
30 lines
1.2 KiB
PHP
<?php
|
|
// When symlinked into Kimai's var/plugins/, the vendor autoload is two levels up
|
|
$autoloadPaths = [
|
|
__DIR__ . '/../dev/kimai/vendor/autoload.php', // Running from plugin root
|
|
__DIR__ . '/../../../vendor/autoload.php', // Running from inside var/plugins/
|
|
];
|
|
|
|
foreach ($autoloadPaths as $path) {
|
|
if (file_exists($path)) {
|
|
$loader = require_once $path;
|
|
// In worktree contexts, register a prepended autoloader so worktree classes
|
|
// take priority over the classmap entries pointing to the main repo symlink.
|
|
$pluginRoot = dirname(__DIR__) . '/';
|
|
spl_autoload_register(function (string $class) use ($pluginRoot) {
|
|
$prefix = 'KimaiPlugin\\KimaiHeatmapBundle\\';
|
|
if (str_starts_with($class, $prefix)) {
|
|
$relative = str_replace('\\', '/', substr($class, strlen($prefix)));
|
|
$file = $pluginRoot . $relative . '.php';
|
|
if (file_exists($file)) {
|
|
require $file;
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}, true, true); // prepend=true
|
|
return;
|
|
}
|
|
}
|
|
|
|
throw new RuntimeException('Cannot find Kimai vendor/autoload.php. Run composer install in dev/kimai/ first.');
|