| Methods |
public
|
getRepository<T is object>(class-string<T> $className)
{@inheritDoc}
|
#
|
public
|
getCache(): Cache|null
Returns the cache API for managing the second level cache regions or NULL if the cache is not enabled.
Returns the cache API for managing the second level cache regions or NULL if the cache is not enabled.
Implemented by
|
#
|
public
|
getConnection(): Connection
Gets the database connection object used by the EntityManager.
Gets the database connection object used by the EntityManager.
Implemented by
|
#
|
public
|
getExpressionBuilder(): Expr
Gets an ExpressionBuilder used for object-oriented construction of query expressions.
Gets an ExpressionBuilder used for object-oriented construction of query expressions.
Example:
$qb = $em->createQueryBuilder();
$expr = $em->getExpressionBuilder();
$qb->select('u')->from('User', 'u')
->where($expr->orX($expr->eq('u.id', 1), $expr->eq('u.id', 2)));
Implemented by
|
#
|
public
|
beginTransaction(): void
Starts a transaction on the underlying database connection.
Starts a transaction on the underlying database connection.
Implemented by
|
#
|
public
|
transactional(callable $func): mixed
Executes a function in a transaction.
Executes a function in a transaction.
The function gets passed this EntityManager instance as an (optional) parameter.
{@link flush} is invoked prior to transaction commit.
If an exception occurs during execution of the function or flushing or transaction commit,
the transaction is rolled back, the EntityManager closed and the exception re-thrown.
Deprecated
2.10 Use {@link wrapInTransaction} instead.
Parameters
| $func |
The function to execute transactionally.
|
Returns
The non-empty value returned from the closure or true instead.
Implemented by
|
#
|
public
|
commit(): void
Commits a transaction on the underlying database connection.
Commits a transaction on the underlying database connection.
Implemented by
|
#
|
public
|
rollback(): void
Performs a rollback on the underlying database connection.
Performs a rollback on the underlying database connection.
Implemented by
|
#
|
public
|
createQuery(string $dql = ''): Query
Creates a new Query object.
Creates a new Query object.
Parameters
Implemented by
|
#
|
public
|
createNamedQuery(string $name): Query
Creates a Query from a named query.
Creates a Query from a named query.
Implemented by
|
#
|
public
|
createNativeQuery(string $sql, ResultSetMapping $rsm): NativeQuery
Creates a native SQL query.
Creates a native SQL query.
Parameters
| $rsm |
The ResultSetMapping to use.
|
Implemented by
|
#
|
public
|
createNamedNativeQuery(string $name): NativeQuery
Creates a NativeQuery from a named native query.
Creates a NativeQuery from a named native query.
Implemented by
|
#
|
public
|
createQueryBuilder(): QueryBuilder
Create a QueryBuilder instance
Create a QueryBuilder instance
Implemented by
|
#
|
public
|
getReference<T>(class-string<T> $entityName, mixed $id): object|null
Gets a reference to the entity identified by the given type and identifier
without actually loading it, if the entity…
Gets a reference to the entity identified by the given type and identifier
without actually loading it, if the entity is not yet loaded.
Parameters
| $id |
The entity identifier.
|
Returns
Throws
Implemented by
|
#
|
public
|
getPartialReference<T>(class-string<T> $entityName, mixed $identifier): object|null
Gets a partial reference to the entity identified by the given type and identifier
without actually loading it, if the…
Gets a partial reference to the entity identified by the given type and identifier
without actually loading it, if the entity is not yet loaded.
The returned reference may be a partial object if the entity is not yet loaded/managed.
If it is a partial object it will not initialize the rest of the entity state on access.
Thus you can only ever safely access the identifier of an entity obtained through
this method.
The use-cases for partial references involve maintaining bidirectional associations
without loading one side of the association or to update an entity without loading it.
Note, however, that in the latter case the original (persistent) entity data will
never be visible to the application (especially not event listeners) as it will
never be loaded in the first place.
Parameters
| $identifier |
The entity identifier.
|
Returns
The (partial) entity reference
Implemented by
|
#
|
public
|
close(): void
Closes the EntityManager. All entities that are currently managed
by this EntityManager become detached. The…
Closes the EntityManager. All entities that are currently managed
by this EntityManager become detached. The EntityManager may no longer
be used after it is closed.
Implemented by
|
#
|
public
|
copy(object $entity, bool $deep = false): object
Creates a copy of the given entity. Can create a shallow or a deep copy.
Creates a copy of the given entity. Can create a shallow or a deep copy.
Deprecated
2.7 This method is being removed from the ORM and won't have any replacement
Parameters
| $entity |
The entity to copy.
|
| $deep |
FALSE for a shallow copy, TRUE for a deep copy.
|
Returns
Throws
Implemented by
|
#
|
public
|
lock(object $entity, LockMode::* $lockMode, int|DateTimeInterface|null $lockVersion = null): void
Acquire a lock on the given entity.
Acquire a lock on the given entity.
Throws
Implemented by
|
#
|
public
|
getEventManager(): EventManager
Gets the EventManager used by the EntityManager.
Gets the EventManager used by the EntityManager.
Implemented by
|
#
|
public
|
getConfiguration(): Configuration
Gets the Configuration used by the EntityManager.
Gets the Configuration used by the EntityManager.
Implemented by
|
#
|
public
|
isOpen(): bool
Check if the Entity manager is open or closed.
Check if the Entity manager is open or closed.
Implemented by
|
#
|
public
|
getUnitOfWork(): UnitOfWork
Gets the UnitOfWork used by the EntityManager to coordinate operations.
Gets the UnitOfWork used by the EntityManager to coordinate operations.
Implemented by
|
#
|
public
|
getHydrator(string|AbstractQuery::HYDRATE_* $hydrationMode): AbstractHydrator
Gets a hydrator for the given hydration mode.
Gets a hydrator for the given hydration mode.
This method caches the hydrator instances which is used for all queries that don't
selectively iterate over the result.
Implemented by
|
#
|
public
|
newHydrator(string|AbstractQuery::HYDRATE_* $hydrationMode): AbstractHydrator
Create a new instance for the given hydration mode.
Create a new instance for the given hydration mode.
Throws
Implemented by
|
#
|
public
|
getProxyFactory(): ProxyFactory
Gets the proxy factory used by the EntityManager to create entity proxies.
Gets the proxy factory used by the EntityManager to create entity proxies.
Implemented by
|
#
|
public
|
getFilters(): FilterCollection
Gets the enabled filters.
Gets the enabled filters.
Returns
The active filter collection.
Implemented by
|
#
|
public
|
isFiltersStateClean(): bool
Checks whether the state of the filter collection is clean.
Checks whether the state of the filter collection is clean.
Returns
True, if the filter collection is clean.
Implemented by
|
#
|
public
|
hasFilters(): bool
Checks whether the Entity Manager has filters.
Checks whether the Entity Manager has filters.
Returns
True, if the EM has a filter collection.
Implemented by
|
#
|
public
|
getClassMetadata<T is object>(string|class-string<T> $className): ClassMetadata
{@inheritDoc}
|
#
|
public
|
getMetadataFactory(): ClassMetadataFactory
|
#
|
public
|
wrapInTransaction(callable $func): mixed
|
#
|
public
|
refresh(object $object, ?int $lockMode = null): void
|
#
|