ContainerRepositoryFactory
in package
implements
RepositoryFactory
Fetches repositories from the container or falls back to normal creation.
Interfaces, Classes, Traits and Enums
- RepositoryFactory
- Interface for entity repository factory.
Table of Contents
- $container : ContainerInterface
- $managedRepositories : array<string|int, ObjectRepository>
- __construct() : mixed
- getRepository() : ObjectRepository
- Gets the repository for an entity class.
- getOrCreateRepository() : ObjectRepository
Properties
$container
private
ContainerInterface
$container
$managedRepositories
private
array<string|int, ObjectRepository>
$managedRepositories
= []
Methods
__construct()
public
__construct(ContainerInterface $container) : mixed
Parameters
- $container : ContainerInterface
-
A service locator containing the repositories
Return values
mixed —getRepository()
Gets the repository for an entity class.
public
getRepository(EntityManagerInterface $entityManager, mixed $entityName) : ObjectRepository
Parameters
- $entityManager : EntityManagerInterface
-
The EntityManager instance.
- $entityName : mixed
-
The name of the entity.
Return values
ObjectRepository —getOrCreateRepository()
private
getOrCreateRepository(EntityManagerInterface $entityManager, ClassMetadata $metadata) : ObjectRepository
Parameters
- $entityManager : EntityManagerInterface
- $metadata : ClassMetadata