EntityManagerDecorator
extends ObjectManagerDecorator
in package
implements
EntityManagerInterface
Base class for EntityManager decorators
Interfaces, Classes, Traits and Enums
- EntityManagerInterface
- EntityManager interface
Table of Contents
- $wrapped : EntityManagerInterface
- __construct() : mixed
- beginTransaction() : void
- Starts a transaction on the underlying database connection.
- clear() : void
- Clears the ObjectManager. All objects that are currently managed by this ObjectManager become detached.
- close() : void
- 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.
- commit() : void
- Commits a transaction on the underlying database connection.
- contains() : bool
- Checks if the object is part of the current UnitOfWork and therefore managed.
- copy() : object
- Creates a copy of the given entity. Can create a shallow or a deep copy.
- createNamedNativeQuery() : NativeQuery
- Creates a NativeQuery from a named native query.
- createNamedQuery() : Query
- Creates a Query from a named query.
- createNativeQuery() : NativeQuery
- Creates a native SQL query.
- createQuery() : Query
- Creates a new Query object.
- createQueryBuilder() : QueryBuilder
- Create a QueryBuilder instance
- detach() : void
- Detaches an object from the ObjectManager, causing a managed object to become detached. Unflushed changes made to the object if any (including removal of the object), will not be synchronized to the database.
- find() : object|null
- Finds an object by its identifier.
- flush() : void
- Flushes all changes to objects that have been queued up to now to the database.
- getCache() : Cache|null
- Returns the cache API for managing the second level cache regions or NULL if the cache is not enabled.
- getClassMetadata() : ClassMetadata
- Returns the ClassMetadata descriptor for a class.
- getConfiguration() : Configuration
- Gets the Configuration used by the EntityManager.
- getConnection() : Connection
- Gets the database connection object used by the EntityManager.
- getEventManager() : EventManager
- Gets the EventManager used by the EntityManager.
- getExpressionBuilder() : Expr
- Gets an ExpressionBuilder used for object-oriented construction of query expressions.
- getFilters() : FilterCollection
- Gets the enabled filters.
- getHydrator() : AbstractHydrator
- Gets a hydrator for the given hydration mode.
- getMetadataFactory() : ClassMetadataFactory
- Gets the metadata factory used to gather the metadata of classes.
- getPartialReference() : object|null
- 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.
- getProxyFactory() : ProxyFactory
- Gets the proxy factory used by the EntityManager to create entity proxies.
- getReference() : object|null
- Gets a reference to the entity identified by the given type and identifier without actually loading it, if the entity is not yet loaded.
- getRepository() : ObjectRepository
- Gets the repository for a class.
- getUnitOfWork() : UnitOfWork
- Gets the UnitOfWork used by the EntityManager to coordinate operations.
- hasFilters() : bool
- Checks whether the Entity Manager has filters.
- initializeObject() : void
- Helper method to initialize a lazy loading proxy or persistent collection.
- isFiltersStateClean() : bool
- Checks whether the state of the filter collection is clean.
- isOpen() : bool
- Check if the Entity manager is open or closed.
- lock() : void
- Acquire a lock on the given entity.
- merge() : object
- Merges the state of a detached object into the persistence context of this ObjectManager and returns the managed copy of the object.
- newHydrator() : AbstractHydrator
- Create a new instance for the given hydration mode.
- persist() : void
- Tells the ObjectManager to make an instance managed and persistent.
- refresh() : void
- Refreshes the persistent state of an object from the database, overriding any local changes that have not yet been persisted.
- remove() : void
- Removes an object instance.
- rollback() : void
- Performs a rollback on the underlying database connection.
- transactional() : mixed
- Executes a function in a transaction.
- wrapInTransaction() : mixed
- {@inheritdoc}
Properties
$wrapped
protected
EntityManagerInterface
$wrapped
Methods
__construct()
public
__construct(EntityManagerInterface $wrapped) : mixed
Parameters
- $wrapped : EntityManagerInterface
Return values
mixed —beginTransaction()
Starts a transaction on the underlying database connection.
public
beginTransaction() : void
Return values
void —clear()
Clears the ObjectManager. All objects that are currently managed by this ObjectManager become detached.
public
clear([mixed $objectName = null ]) : void
Parameters
- $objectName : mixed = null
-
if given, only objects of this type will get detached.
Return values
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.
public
close() : void
Return values
void —commit()
Commits a transaction on the underlying database connection.
public
commit() : void
Return values
void —contains()
Checks if the object is part of the current UnitOfWork and therefore managed.
public
contains(mixed $object) : bool
Parameters
- $object : mixed
Return values
bool —copy()
Creates a copy of the given entity. Can create a shallow or a deep copy.
public
copy(mixed $entity[, mixed $deep = false ]) : object
Parameters
- $entity : mixed
-
The entity to copy.
- $deep : mixed = false
-
FALSE for a shallow copy, TRUE for a deep copy.
Return values
object —The new entity.
createNamedNativeQuery()
Creates a NativeQuery from a named native query.
public
createNamedNativeQuery(mixed $name) : NativeQuery
Parameters
- $name : mixed
Return values
NativeQuery —createNamedQuery()
Creates a Query from a named query.
public
createNamedQuery(mixed $name) : Query
Parameters
- $name : mixed
Return values
Query —createNativeQuery()
Creates a native SQL query.
public
createNativeQuery(mixed $sql, ResultSetMapping $rsm) : NativeQuery
Parameters
- $sql : mixed
- $rsm : ResultSetMapping
-
The ResultSetMapping to use.
Return values
NativeQuery —createQuery()
Creates a new Query object.
public
createQuery([mixed $dql = '' ]) : Query
Parameters
- $dql : mixed = ''
-
The DQL string.
Return values
Query —createQueryBuilder()
Create a QueryBuilder instance
public
createQueryBuilder() : QueryBuilder
Return values
QueryBuilder —detach()
Detaches an object from the ObjectManager, causing a managed object to become detached. Unflushed changes made to the object if any (including removal of the object), will not be synchronized to the database.
public
detach(mixed $object) : void
Parameters
- $object : mixed
-
The object to detach.
Return values
void —find()
Finds an object by its identifier.
public
find(mixed $className, mixed $id[, mixed $lockMode = null ][, mixed $lockVersion = null ]) : object|null
Parameters
- $className : mixed
-
The class name of the object to find.
- $id : mixed
-
The identity of the object to find.
- $lockMode : mixed = null
- $lockVersion : mixed = null
Return values
object|null —The found object.
flush()
Flushes all changes to objects that have been queued up to now to the database.
public
flush([mixed $entity = null ]) : void
Parameters
- $entity : mixed = null
Return values
void —getCache()
Returns the cache API for managing the second level cache regions or NULL if the cache is not enabled.
public
getCache() : Cache|null
Return values
Cache|null —getClassMetadata()
Returns the ClassMetadata descriptor for a class.
public
getClassMetadata(mixed $className) : ClassMetadata
Parameters
- $className : mixed
Return values
ClassMetadata —getConfiguration()
Gets the Configuration used by the EntityManager.
public
getConfiguration() : Configuration
Return values
Configuration —getConnection()
Gets the database connection object used by the EntityManager.
public
getConnection() : Connection
Return values
Connection —getEventManager()
Gets the EventManager used by the EntityManager.
public
getEventManager() : EventManager
Return values
EventManager —getExpressionBuilder()
Gets an ExpressionBuilder used for object-oriented construction of query expressions.
public
getExpressionBuilder() : Expr
Return values
Expr —getFilters()
Gets the enabled filters.
public
getFilters() : FilterCollection
Return values
FilterCollection —The active filter collection.
getHydrator()
Gets a hydrator for the given hydration mode.
public
getHydrator(mixed $hydrationMode) : AbstractHydrator
Parameters
- $hydrationMode : mixed
Return values
AbstractHydrator —getMetadataFactory()
Gets the metadata factory used to gather the metadata of classes.
public
getMetadataFactory() : ClassMetadataFactory
Return values
ClassMetadataFactory —getPartialReference()
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.
public
getPartialReference(mixed $entityName, mixed $identifier) : object|null
Parameters
- $entityName : mixed
-
The name of the entity type.
- $identifier : mixed
-
The entity identifier.
Return values
object|null —The (partial) entity reference
getProxyFactory()
Gets the proxy factory used by the EntityManager to create entity proxies.
public
getProxyFactory() : ProxyFactory
Return values
ProxyFactory —getReference()
Gets a reference to the entity identified by the given type and identifier without actually loading it, if the entity is not yet loaded.
public
getReference(mixed $entityName, mixed $id) : object|null
Parameters
- $entityName : mixed
-
The name of the entity type.
- $id : mixed
-
The entity identifier.
Return values
object|null —The entity reference.
getRepository()
Gets the repository for a class.
public
getRepository(mixed $className) : ObjectRepository
Parameters
- $className : mixed
Return values
ObjectRepository —getUnitOfWork()
Gets the UnitOfWork used by the EntityManager to coordinate operations.
public
getUnitOfWork() : UnitOfWork
Return values
UnitOfWork —hasFilters()
Checks whether the Entity Manager has filters.
public
hasFilters() : bool
Return values
bool —True, if the EM has a filter collection.
initializeObject()
Helper method to initialize a lazy loading proxy or persistent collection.
public
initializeObject(mixed $obj) : void
Parameters
- $obj : mixed
Return values
void —isFiltersStateClean()
Checks whether the state of the filter collection is clean.
public
isFiltersStateClean() : bool
Return values
bool —True, if the filter collection is clean.
isOpen()
Check if the Entity manager is open or closed.
public
isOpen() : bool
Return values
bool —lock()
Acquire a lock on the given entity.
public
lock(mixed $entity, mixed $lockMode[, mixed $lockVersion = null ]) : void
Parameters
- $entity : mixed
- $lockMode : mixed
- $lockVersion : mixed = null
Return values
void —merge()
Merges the state of a detached object into the persistence context of this ObjectManager and returns the managed copy of the object.
public
merge(mixed $object) : object
Parameters
- $object : mixed
Return values
object —newHydrator()
Create a new instance for the given hydration mode.
public
newHydrator(mixed $hydrationMode) : AbstractHydrator
Parameters
- $hydrationMode : mixed
Return values
AbstractHydrator —persist()
Tells the ObjectManager to make an instance managed and persistent.
public
persist(mixed $object) : void
Parameters
- $object : mixed
-
The instance to make managed and persistent.
Return values
void —refresh()
Refreshes the persistent state of an object from the database, overriding any local changes that have not yet been persisted.
public
refresh(mixed $object) : void
Parameters
- $object : mixed
-
The object to refresh.
Return values
void —remove()
Removes an object instance.
public
remove(mixed $object) : void
Parameters
- $object : mixed
-
The object instance to remove.
Return values
void —rollback()
Performs a rollback on the underlying database connection.
public
rollback() : void
Return values
void —transactional()
Executes a function in a transaction.
public
transactional(mixed $func) : mixed
Parameters
- $func : mixed
-
The function to execute transactionally.
Return values
mixed —The non-empty value returned from the closure or true instead.
wrapInTransaction()
{@inheritdoc}
public
wrapInTransaction(callable $func) : mixed
Parameters
- $func : callable