2026-03-04 15:56:58 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace MintyPHP\App\Container\Registrars;
|
|
|
|
|
|
|
|
|
|
use MintyPHP\App\AppContainer;
|
|
|
|
|
use MintyPHP\App\Container\ContainerRegistrar;
|
2026-03-25 10:02:03 +01:00
|
|
|
use MintyPHP\App\Module\ModuleClassResolver;
|
2026-03-19 18:20:13 +01:00
|
|
|
use MintyPHP\App\Module\ModuleEventDispatcher;
|
2026-03-19 08:23:14 +01:00
|
|
|
use MintyPHP\App\Module\ModuleRegistry;
|
2026-03-06 00:44:52 +01:00
|
|
|
use MintyPHP\Http\CookieStoreInterface;
|
|
|
|
|
use MintyPHP\Http\RequestRuntimeInterface;
|
|
|
|
|
use MintyPHP\Http\SessionStoreInterface;
|
2026-03-04 15:56:58 +01:00
|
|
|
use MintyPHP\Repository\Support\DatabaseSessionRepository;
|
|
|
|
|
use MintyPHP\Repository\Tenant\TenantRepository;
|
|
|
|
|
use MintyPHP\Service\Access\AccessGatewayFactory;
|
|
|
|
|
use MintyPHP\Service\Access\AccessPolicyFactory;
|
|
|
|
|
use MintyPHP\Service\Access\AccessRepositoryFactory;
|
|
|
|
|
use MintyPHP\Service\Access\AccessServicesFactory;
|
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
|
|
|
use MintyPHP\Service\Access\AssignableRoleService;
|
2026-03-13 11:31:33 +01:00
|
|
|
use MintyPHP\Service\Access\PermissionService;
|
2026-03-04 15:56:58 +01:00
|
|
|
use MintyPHP\Service\Audit\AuditRepositoryFactory;
|
|
|
|
|
use MintyPHP\Service\Audit\AuditServicesFactory;
|
|
|
|
|
use MintyPHP\Service\Auth\AuthGatewayFactory;
|
|
|
|
|
use MintyPHP\Service\Auth\AuthRepositoryFactory;
|
|
|
|
|
use MintyPHP\Service\Auth\AuthServicesFactory;
|
|
|
|
|
use MintyPHP\Service\Branding\BrandingServicesFactory;
|
|
|
|
|
use MintyPHP\Service\CustomField\CustomFieldServicesFactory;
|
|
|
|
|
use MintyPHP\Service\Directory\DirectoryGatewayFactory;
|
|
|
|
|
use MintyPHP\Service\Directory\DirectoryRepositoryFactory;
|
|
|
|
|
use MintyPHP\Service\Directory\DirectoryServicesFactory;
|
|
|
|
|
use MintyPHP\Service\Import\ImportRepositoryFactory;
|
|
|
|
|
use MintyPHP\Service\Import\ImportServicesFactory;
|
|
|
|
|
use MintyPHP\Service\Mail\MailRepositoryFactory;
|
|
|
|
|
use MintyPHP\Service\Mail\MailServicesFactory;
|
|
|
|
|
use MintyPHP\Service\Scheduler\SchedulerRepositoryFactory;
|
|
|
|
|
use MintyPHP\Service\Scheduler\SchedulerServicesFactory;
|
|
|
|
|
use MintyPHP\Service\Security\SecurityRepositoryFactory;
|
|
|
|
|
use MintyPHP\Service\Security\SecurityServicesFactory;
|
|
|
|
|
use MintyPHP\Service\Settings\SettingRepositoryFactory;
|
|
|
|
|
use MintyPHP\Service\Settings\SettingServicesFactory;
|
|
|
|
|
use MintyPHP\Service\Tenant\TenantRepositoryFactory;
|
|
|
|
|
use MintyPHP\Service\Tenant\TenantScopeService;
|
|
|
|
|
use MintyPHP\Service\Tenant\TenantServicesFactory;
|
|
|
|
|
use MintyPHP\Service\User\UserGatewayFactory;
|
|
|
|
|
use MintyPHP\Service\User\UserRepositoryFactory;
|
|
|
|
|
use MintyPHP\Service\User\UserServicesFactory;
|
|
|
|
|
|
|
|
|
|
final class ServiceFactoryRegistrar implements ContainerRegistrar
|
|
|
|
|
{
|
|
|
|
|
public function register(AppContainer $container): void
|
|
|
|
|
{
|
|
|
|
|
$container->set(SettingServicesFactory::class, static fn (AppContainer $c): SettingServicesFactory => new SettingServicesFactory(
|
|
|
|
|
$c->get(SettingRepositoryFactory::class)
|
|
|
|
|
));
|
|
|
|
|
$container->set(AuditServicesFactory::class, static fn (AppContainer $c): AuditServicesFactory => new AuditServicesFactory(
|
|
|
|
|
$c->get(AuditRepositoryFactory::class),
|
2026-03-06 00:44:52 +01:00
|
|
|
$c->get(SettingServicesFactory::class)->createSettingsSystemAuditGateway(),
|
|
|
|
|
$c->get(RequestRuntimeInterface::class),
|
|
|
|
|
$c->get(SessionStoreInterface::class)
|
2026-03-04 15:56:58 +01:00
|
|
|
));
|
|
|
|
|
$container->set(SecurityServicesFactory::class, static fn (AppContainer $c): SecurityServicesFactory => new SecurityServicesFactory(
|
|
|
|
|
$c->get(SecurityRepositoryFactory::class)
|
|
|
|
|
));
|
|
|
|
|
$container->set(MailServicesFactory::class, static fn (AppContainer $c): MailServicesFactory => new MailServicesFactory(
|
|
|
|
|
$c->get(MailRepositoryFactory::class),
|
2026-03-06 00:44:52 +01:00
|
|
|
$c->get(SettingServicesFactory::class)->createSettingsSmtpGateway()
|
2026-03-04 15:56:58 +01:00
|
|
|
));
|
|
|
|
|
$container->set(BrandingServicesFactory::class, static fn (AppContainer $c): BrandingServicesFactory => new BrandingServicesFactory(
|
2026-03-06 00:44:52 +01:00
|
|
|
$c->get(SettingServicesFactory::class)->createSettingsAppGateway()
|
2026-03-04 15:56:58 +01:00
|
|
|
));
|
|
|
|
|
$container->set(CustomFieldServicesFactory::class, static fn (AppContainer $c): CustomFieldServicesFactory => new CustomFieldServicesFactory(
|
|
|
|
|
$c->get(TenantRepository::class),
|
2026-03-13 11:31:33 +01:00
|
|
|
$c->get(TenantScopeService::class)
|
2026-03-04 15:56:58 +01:00
|
|
|
));
|
|
|
|
|
$container->set(TenantServicesFactory::class, static fn (AppContainer $c): TenantServicesFactory => new TenantServicesFactory(
|
2026-03-13 11:31:33 +01:00
|
|
|
$c->get(PermissionService::class),
|
2026-03-04 15:56:58 +01:00
|
|
|
$c->get(TenantRepositoryFactory::class)
|
|
|
|
|
));
|
|
|
|
|
$container->set(ImportServicesFactory::class, static fn (AppContainer $c): ImportServicesFactory => new ImportServicesFactory(
|
|
|
|
|
$c->get(UserServicesFactory::class),
|
|
|
|
|
$c->get(AccessServicesFactory::class),
|
|
|
|
|
$c->get(SettingServicesFactory::class),
|
|
|
|
|
$c->get(DirectoryServicesFactory::class),
|
2026-03-06 00:44:52 +01:00
|
|
|
$c->get(ImportRepositoryFactory::class),
|
2026-03-13 11:31:33 +01:00
|
|
|
$c->get(TenantScopeService::class),
|
2026-03-06 00:44:52 +01:00
|
|
|
$c->get(SessionStoreInterface::class)
|
2026-03-04 15:56:58 +01:00
|
|
|
));
|
|
|
|
|
$container->set(SchedulerServicesFactory::class, static fn (AppContainer $c): SchedulerServicesFactory => new SchedulerServicesFactory(
|
|
|
|
|
$c->get(UserServicesFactory::class),
|
|
|
|
|
$c->get(AuditServicesFactory::class),
|
|
|
|
|
$c->get(DatabaseSessionRepository::class),
|
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
|
|
|
$c->get(SchedulerRepositoryFactory::class),
|
|
|
|
|
$c
|
2026-03-04 15:56:58 +01:00
|
|
|
));
|
|
|
|
|
$container->set(DirectoryServicesFactory::class, static fn (AppContainer $c): DirectoryServicesFactory => new DirectoryServicesFactory(
|
|
|
|
|
$c->get(UserServicesFactory::class),
|
|
|
|
|
$c->get(AuditServicesFactory::class),
|
|
|
|
|
$c->get(DirectoryRepositoryFactory::class),
|
|
|
|
|
$c->get(DirectoryGatewayFactory::class)
|
|
|
|
|
));
|
|
|
|
|
$container->set(DirectoryGatewayFactory::class, static fn (AppContainer $c): DirectoryGatewayFactory => new DirectoryGatewayFactory(
|
|
|
|
|
$c->get(SettingServicesFactory::class),
|
|
|
|
|
$c->get(TenantScopeService::class)
|
|
|
|
|
));
|
|
|
|
|
$container->set(AccessServicesFactory::class, static fn (AppContainer $c): AccessServicesFactory => new AccessServicesFactory(
|
|
|
|
|
$c->get(AccessRepositoryFactory::class),
|
|
|
|
|
$c->get(AccessGatewayFactory::class),
|
2026-03-06 00:44:52 +01:00
|
|
|
// Wrapped in a second closure to break the circular dependency:
|
2026-03-13 11:31:33 +01:00
|
|
|
// AccessServicesFactory <-> AccessPolicyFactory via PermissionService.
|
2026-03-04 15:56:58 +01:00
|
|
|
static fn (): AccessPolicyFactory => $c->get(AccessPolicyFactory::class)
|
|
|
|
|
));
|
|
|
|
|
$container->set(AccessGatewayFactory::class, static fn (AppContainer $c): AccessGatewayFactory => new AccessGatewayFactory(
|
|
|
|
|
$c->get(AccessRepositoryFactory::class),
|
2026-03-06 00:44:52 +01:00
|
|
|
$c->get(AuditServicesFactory::class),
|
|
|
|
|
$c->get(SessionStoreInterface::class)
|
2026-03-04 15:56:58 +01:00
|
|
|
));
|
|
|
|
|
$container->set(AccessPolicyFactory::class, static fn (AppContainer $c): AccessPolicyFactory => new AccessPolicyFactory(
|
2026-03-13 11:31:33 +01:00
|
|
|
$c->get(PermissionService::class),
|
2026-03-19 08:23:14 +01:00
|
|
|
$c->get(TenantScopeService::class),
|
2026-03-25 10:02:03 +01:00
|
|
|
$c->has(ModuleRegistry::class) ? $c->get(ModuleRegistry::class) : null,
|
|
|
|
|
static fn (string $class): ?object => ModuleClassResolver::resolve($c, $class)
|
2026-03-04 15:56:58 +01:00
|
|
|
));
|
|
|
|
|
$container->set(UserGatewayFactory::class, static fn (AppContainer $c): UserGatewayFactory => new UserGatewayFactory(
|
|
|
|
|
$c->get(AccessServicesFactory::class),
|
|
|
|
|
$c->get(SettingServicesFactory::class),
|
2026-03-05 11:17:42 +01:00
|
|
|
$c->get(TenantScopeService::class),
|
|
|
|
|
$c->get(DirectoryRepositoryFactory::class),
|
2026-03-04 15:56:58 +01:00
|
|
|
));
|
|
|
|
|
$container->set(UserServicesFactory::class, static fn (AppContainer $c): UserServicesFactory => new UserServicesFactory(
|
|
|
|
|
$c->get(AuditServicesFactory::class),
|
|
|
|
|
$c->get(UserRepositoryFactory::class),
|
|
|
|
|
$c->get(UserGatewayFactory::class),
|
2026-03-13 21:11:48 +01:00
|
|
|
$c->get(DatabaseSessionRepository::class),
|
|
|
|
|
// Wrapped in a closure to break circular dependency:
|
|
|
|
|
// UserServicesFactory -> AssignableRoleService -> RoleRepository -> DirectoryServicesFactory -> UserServicesFactory
|
2026-03-19 18:20:13 +01:00
|
|
|
static fn (): AssignableRoleService => $c->get(AssignableRoleService::class),
|
|
|
|
|
$c->has(ModuleEventDispatcher::class) ? $c->get(ModuleEventDispatcher::class) : null
|
2026-03-04 15:56:58 +01:00
|
|
|
));
|
|
|
|
|
$container->set(AuthGatewayFactory::class, static fn (AppContainer $c): AuthGatewayFactory => new AuthGatewayFactory(
|
|
|
|
|
$c->get(AuthRepositoryFactory::class),
|
|
|
|
|
$c->get(AccessServicesFactory::class),
|
|
|
|
|
$c->get(SettingServicesFactory::class),
|
|
|
|
|
$c->get(TenantScopeService::class)
|
|
|
|
|
));
|
|
|
|
|
$container->set(AuthServicesFactory::class, static fn (AppContainer $c): AuthServicesFactory => new AuthServicesFactory(
|
|
|
|
|
$c->get(UserServicesFactory::class),
|
|
|
|
|
$c->get(AuditServicesFactory::class),
|
|
|
|
|
$c->get(MailServicesFactory::class),
|
|
|
|
|
$c->get(AuthRepositoryFactory::class),
|
|
|
|
|
$c->get(AuthGatewayFactory::class),
|
2026-03-06 00:44:52 +01:00
|
|
|
$c->get(DatabaseSessionRepository::class),
|
|
|
|
|
$c->get(SessionStoreInterface::class),
|
|
|
|
|
$c->get(CookieStoreInterface::class),
|
2026-03-14 21:45:58 +01:00
|
|
|
$c->get(RequestRuntimeInterface::class),
|
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
|
|
|
$c
|
2026-03-04 15:56:58 +01:00
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
}
|