getRepositoryHash example


final class TestRepositoryFactory implements RepositoryFactory
{
    /** * @var array<string, ObjectRepository> */
    private array $repositoryList = [];

    public function getRepository(EntityManagerInterface $entityManager$entityName): ObjectRepository
    {
        $repositoryHash = $this->getRepositoryHash($entityManager$entityName);

        return $this->repositoryList[$repositoryHash] ??= $this->createRepository($entityManager$entityName);
    }

    public function setRepository(EntityManagerInterface $entityManager, string $entityName, ObjectRepository $repository): void
    {
        $repositoryHash = $this->getRepositoryHash($entityManager$entityName);

        $this->repositoryList[$repositoryHash] = $repository;
    }

    
Home | Imprint | This part of the site doesn't use cookies.