EntityManagerDecorator
abstract class EntityManagerDecorator extends ObjectManagerDecorator implements EntityManagerInterface (View source)
Base class for EntityManager decorators
Properties
protected EntityManagerInterface | $wrapped |
Methods
Gets the database connection object used by the EntityManager.
Gets an ExpressionBuilder used for object-oriented construction of query expressions.
Starts a transaction on the underlying database connection.
Executes a function in a transaction.
Commits a transaction on the underlying database connection.
Performs a rollback on the underlying database connection.
Creates a new Query object.
Creates a Query from a named query.
Creates a NativeQuery from a named native query.
Create a QueryBuilder instance
Gets a reference to the entity identified by the given type and identifier without actually loading it, if the entity is not yet loaded.
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.
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.
Creates a copy of the given entity. Can create a shallow or a deep copy.
Acquire a lock on the given entity.
{@inheritdoc}
{@inheritdoc}
Gets the EventManager used by the EntityManager.
Gets the Configuration used by the EntityManager.
Check if the Entity manager is open or closed.
Gets the UnitOfWork used by the EntityManager to coordinate operations.
Gets a hydrator for the given hydration mode.
Create a new instance for the given hydration mode.
Gets the proxy factory used by the EntityManager to create entity proxies.
Gets the enabled filters.
Checks whether the state of the filter collection is clean.
Checks whether the Entity Manager has filters.
Details
at line 42
__construct(EntityManagerInterface $wrapped)
at line 50
Connection
getConnection()
Gets the database connection object used by the EntityManager.
at line 58
Expr
getExpressionBuilder()
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)));
at line 66
void
beginTransaction()
Starts a transaction on the underlying database connection.
at line 74
mixed
transactional(callable $func)
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.
at line 82
void
commit()
Commits a transaction on the underlying database connection.
at line 90
void
rollback()
Performs a rollback on the underlying database connection.
at line 114
NativeQuery
createNativeQuery(string $sql, ResultSetMapping $rsm)
Creates a native SQL query.
at line 122
NativeQuery
createNamedNativeQuery(string $name)
Creates a NativeQuery from a named native query.
at line 130
QueryBuilder
createQueryBuilder()
Create a QueryBuilder instance
at line 138
object|null
getReference(string $entityName, mixed $id)
Gets a reference to the entity identified by the given type and identifier without actually loading it, if the entity is not yet loaded.
at line 146
object|null
getPartialReference(string $entityName, mixed $identifier)
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.
at line 154
void
close()
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.
at line 162
object
copy(object $entity, boolean $deep = false)
Creates a copy of the given entity. Can create a shallow or a deep copy.
at line 170
void
lock(object $entity, int $lockMode, int|null $lockVersion = null)
Acquire a lock on the given entity.
at line 178
find($entityName, $id, $lockMode = null, $lockVersion = null)
{@inheritdoc}
at line 186
flush($entity = null)
{@inheritdoc}
at line 194
EventManager
getEventManager()
Gets the EventManager used by the EntityManager.
at line 202
Configuration
getConfiguration()
Gets the Configuration used by the EntityManager.
at line 210
bool
isOpen()
Check if the Entity manager is open or closed.
at line 218
UnitOfWork
getUnitOfWork()
Gets the UnitOfWork used by the EntityManager to coordinate operations.
at line 226
AbstractHydrator
getHydrator(int $hydrationMode)
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.
at line 234
AbstractHydrator
newHydrator(int $hydrationMode)
Create a new instance for the given hydration mode.
at line 242
ProxyFactory
getProxyFactory()
Gets the proxy factory used by the EntityManager to create entity proxies.
at line 250
FilterCollection
getFilters()
Gets the enabled filters.
at line 258
boolean
isFiltersStateClean()
Checks whether the state of the filter collection is clean.
at line 266
boolean
hasFilters()
Checks whether the Entity Manager has filters.