Files
breadcrumb-the-shire/lib/Service/Scheduler/SchedulerServicesFactory.php
fs c7b8fd516a feat: extend module platform with UI slots, runtime components, CLI tooling and {{userId}} search support
Completes the generic module platform that enables modules to contribute
UI elements, runtime JS components, and search resources without any
core hardcoding.

New generic UI slot types:
- topbar.right_item: module-contributed topbar buttons
- layout.body_end_template: module-contributed dialog/overlay templates
- layout.head_style: module-contributed global CSS
- runtime.component: declarative JS component registration with phase ordering

New infrastructure:
- ModuleAutoloader: PSR-4 autoloading for module-local PHP classes
- ModuleRuntimePageBuilder: symlinks module pages into runtime directory
- ModuleRuntimeAssetPublisher: publishes module CSS/JS to web/modules/
- ModulePermissionSynchronizer: syncs module permissions to DB
- CLI scripts: module-runtime-sync, module-build, module-migrate,
  module-permissions-sync, module-assets-sync
- {{userId}} placeholder in SearchDataService for user-scoped search queries
- Component runtime with phased initialization (early/default/late)
- AppContainer.protectExistingBindings() to prevent module→core overwrites
- Architecture tests: ModuleStructureContractTest, CoreTemplateIsolationTest,
  FrontendComponentRuntimeContractTest, AppContainerIsolationContractTest

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 22:19:56 +01:00

105 lines
3.6 KiB
PHP

<?php
namespace MintyPHP\Service\Scheduler;
use MintyPHP\App\AppContainer;
use MintyPHP\Repository\Scheduler\ScheduledJobRepositoryInterface;
use MintyPHP\Repository\Scheduler\ScheduledJobRunRepositoryInterface;
use MintyPHP\Repository\Scheduler\SchedulerRuntimeRepositoryInterface;
use MintyPHP\Repository\Support\DatabaseSessionRepository;
use MintyPHP\Service\Audit\AuditServicesFactory;
use MintyPHP\Service\Audit\SystemAuditService;
use MintyPHP\Service\User\UserLifecycleService;
use MintyPHP\Service\User\UserServicesFactory;
class SchedulerServicesFactory
{
private ?ScheduleCalculator $scheduleCalculator = null;
private ?ScheduledJobRegistry $scheduledJobRegistry = null;
private ?ScheduledJobService $scheduledJobService = null;
private ?SchedulerRunService $schedulerRunService = null;
public function __construct(
private readonly UserServicesFactory $userServicesFactory,
private readonly AuditServicesFactory $auditServicesFactory,
private readonly DatabaseSessionRepository $databaseSessionRepository,
private readonly SchedulerRepositoryFactory $schedulerRepositoryFactory,
private readonly AppContainer $appContainer
) {
}
public function createScheduledJobService(): ScheduledJobService
{
return $this->scheduledJobService ??= new ScheduledJobService(
$this->getScheduledJobRepository(),
$this->getScheduledJobRunRepository(),
$this->getScheduledJobRegistry(),
$this->getScheduleCalculator()
);
}
public function createSchedulerRunService(): SchedulerRunService
{
return $this->schedulerRunService ??= new SchedulerRunService(
$this->createScheduledJobService(),
$this->getScheduledJobRepository(),
$this->getScheduledJobRunRepository(),
$this->getSchedulerRuntimeRepository(),
$this->getScheduledJobRegistry(),
$this->getScheduleCalculator(),
$this->getDatabaseSessionRepository(),
$this->getSystemAuditService()
);
}
public function createUserLifecycleService(): UserLifecycleService
{
return $this->getUserLifecycleService();
}
private function getScheduledJobRepository(): ScheduledJobRepositoryInterface
{
return $this->schedulerRepositoryFactory->createScheduledJobRepository();
}
private function getScheduledJobRunRepository(): ScheduledJobRunRepositoryInterface
{
return $this->schedulerRepositoryFactory->createScheduledJobRunRepository();
}
private function getSchedulerRuntimeRepository(): SchedulerRuntimeRepositoryInterface
{
return $this->schedulerRepositoryFactory->createSchedulerRuntimeRepository();
}
private function getScheduleCalculator(): ScheduleCalculator
{
return $this->scheduleCalculator ??= new ScheduleCalculator();
}
private function getUserLifecycleService(): UserLifecycleService
{
return $this->userServicesFactory->createUserLifecycleService();
}
private function getScheduledJobRegistry(): ScheduledJobRegistry
{
return $this->scheduledJobRegistry ??= new ScheduledJobRegistry(
$this->getUserLifecycleService(),
$this->getSystemAuditService(),
$this->appContainer
);
}
private function getDatabaseSessionRepository(): DatabaseSessionRepository
{
return $this->databaseSessionRepository;
}
private function getSystemAuditService(): SystemAuditService
{
return $this->auditServicesFactory->createSystemAuditService();
}
}