instances added god may help

This commit is contained in:
2026-02-23 12:58:19 +01:00
parent 25370a1a55
commit 99db252f60
290 changed files with 9858 additions and 4914 deletions

View File

@@ -0,0 +1,45 @@
<?php
namespace MintyPHP\Service\Access;
use MintyPHP\Repository\Access\PermissionRepository;
use MintyPHP\Repository\Access\RolePermissionRepository;
use MintyPHP\Repository\Access\UserRoleRepository;
class AccessServicesFactory
{
private ?PermissionRepository $permissionRepository = null;
private ?RolePermissionRepository $rolePermissionRepository = null;
private ?UserRoleRepository $userRoleRepository = null;
private ?PermissionService $permissionService = null;
private ?PermissionGateway $permissionGateway = null;
public function createPermissionRepository(): PermissionRepository
{
return $this->permissionRepository ??= new PermissionRepository();
}
public function createRolePermissionRepository(): RolePermissionRepository
{
return $this->rolePermissionRepository ??= new RolePermissionRepository();
}
public function createUserRoleRepository(): UserRoleRepository
{
return $this->userRoleRepository ??= new UserRoleRepository();
}
public function createPermissionService(): PermissionService
{
return $this->permissionService ??= new PermissionService(
$this->createPermissionRepository(),
$this->createRolePermissionRepository(),
$this->createUserRoleRepository()
);
}
public function createPermissionGateway(): PermissionGateway
{
return $this->permissionGateway ??= new PermissionGateway($this->createPermissionService());
}
}