implements |
EntityManagerInterface |
|---|
The EntityManager is the central access point to ORM functionality.
It is a facade to all different ORM subsystems such as UnitOfWork, Query Language and Repository API. Instantiation is done through the static create() method. The quickest way to obtain a fully configured EntityManager is:
use Doctrine\ORM\Tools\ORMSetup; use Doctrine\ORM\EntityManager;
$paths = ['/path/to/entity/mapping/files'];
$config = ORMSetup::createAttributeMetadataConfiguration($paths); $connection = DriverManager::getConnection(['driver' => 'pdo_sqlite', 'memory' => true], $config); $entityManager = new EntityManager($connection, $config);
For more information see {@link http://docs.doctrine-project.org/projects/doctrine-orm/en/stable/reference/configuration.html}
You should never attempt to inherit from the EntityManager: Inheritance is not a valid extension point for the EntityManager. Instead you should take a look at the {@see \Doctrine\ORM\Decorator\EntityManagerDecorator} and wrap your entity manager in a decorator.
| Methods | ||
|---|---|---|
public
|
__construct(Connection $conn, Configuration $config, ?EventManager $eventManager = null)
|
# |
public
|
getConnection()
|
# |
public
|
getMetadataFactory(): ClassMetadataFactory
|
# |
public
|
getExpressionBuilder()
|
# |
public
|
beginTransaction()
|
# |
public
|
getCache()
|
# |
public
|
transactional($func)
|
# |
public
|
wrapInTransaction(callable $func)
|
# |
public
|
commit()
|
# |
public
|
rollback()
|
# |
public
|
getClassMetadata($className)
|
# |
public
|
createQuery($dql = '')
|
# |
public
|
createNamedQuery($name)
|
# |
public
|
createNativeQuery($sql, ResultSetMapping $rsm)
|
# |
public
|
createNamedNativeQuery($name)
|
# |
public
|
createQueryBuilder()
|
# |
public
|
flush(object|mixed[]|null $entity = null): void
|
# |
public
|
find<T>(
class-string<T> $className,
mixed $id,
LockMode::*|null $lockMode = null,
int|null $lockVersion = null,
): object|null
|
# |
public
|
getReference($entityName, $id)
|
# |
public
|
getPartialReference($entityName, $identifier)
|
# |
public
|
clear(string|null $entityName = null): void
|
# |
public
|
close()
|
# |
public
|
persist(object $entity): void
|
# |
public
|
remove(object $entity): void
|
# |
public
|
refresh(object $entity, LockMode::*|null $lockMode = null): void
|
# |
public
|
detach(object $entity): void
|
# |
public
|
merge(object $entity): object
|
# |
public
|
copy($entity, $deep = false)
|
# |
public
|
lock($entity, $lockMode, $lockVersion = null)
|
# |
public
|
getRepository<T is object>(class-string<T> $entityName): ObjectRepository|EntityRepository
|
# |
public
|
contains(object $entity): bool
|
# |
public
|
getEventManager()
|
# |
public
|
getConfiguration()
|
# |
private
|
errorIfClosed(): void
|
# |
public
|
isOpen()
|
# |
public
|
getUnitOfWork()
|
# |
public
|
getHydrator($hydrationMode)
|
# |
public
|
newHydrator($hydrationMode)
|
# |
public
|
getProxyFactory()
|
# |
public
|
initializeObject($obj)
|
# |
public
|
isUninitializedObject($obj): bool
|
# |
public
static
|
create(
array<string, mixed>|Connection $connection,
Configuration $config,
EventManager|null $eventManager = null,
): EntityManager
|
# |
protected
static
|
createConnection(
array<string, mixed>|Connection $connection,
Configuration $config,
EventManager|null $eventManager = null,
): Connection
|
# |
public
|
getFilters()
|
# |
public
|
isFiltersStateClean()
|
# |
public
|
hasFilters()
|
# |
private
|
checkLockRequirements(LockMode::* $lockMode, ClassMetadata $class): void
|
# |
private
|
configureMetadataCache(): void
|
# |
private
|
configureLegacyMetadataCache(): void
|
# |
| Properties | |||
|---|---|---|---|
private
|
Configuration
|
$config
|
# |
private
|
Connection
|
$conn
|
# |
private
|
ClassMetadataFactory
|
$metadataFactory
|
# |
private
|
UnitOfWork
|
$unitOfWork
|
# |
private
|
EventManager
|
$eventManager
|
# |
private
|
ProxyFactory
|
$proxyFactory
|
# |
private
|
RepositoryFactory
|
$repositoryFactory
|
# |
private
|
Expr|null
|
$expressionBuilder
|
# |
private
|
bool
|
$closed = false
|
# |
private
|
FilterCollection|null
|
$filterCollection
|
# |
private
|
Cache|null
|
$cache
|
# |