Doctrine\ORM\EntityManager
The EntityManager is the central access point to ORM functionality.
- Author: Benjamin Eberlei <kontakt@beberlei.de>
Synopsis
class EntityManager
implements
ObjectManager
{
- // members
- private Configuration $config;
- private Connection $conn;
- private ClassMetadataFactory $metadataFactory;
- private array $repositories;
- private UnitOfWork $unitOfWork;
- private EventManager $eventManager;
- private array $hydrators;
- private ProxyFactory $proxyFactory;
- private Expr $expressionBuilder;
- private bool $closed;
- private FilterCollection $filterCollection;
- // methods
- protected void __construct()
- public Connection getConnection()
- public ClassMetadataFactory getMetadataFactory()
- public Expr getExpressionBuilder()
- public void beginTransaction()
- public mixed transactional()
- public void commit()
- public void rollback()
- public ClassMetadata getClassMetadata()
- public Query createQuery()
- public Query createNamedQuery()
- public NativeQuery createNativeQuery()
- public NativeQuery createNamedNativeQuery()
- public QueryBuilder createQueryBuilder()
- public void flush()
- public find()
- public getReference()
- public getPartialReference()
- public void clear()
- public void close()
- public void persist()
- public void remove()
- public void refresh()
- public void detach()
- public merge()
- public copy()
- public void lock()
- public EntityRepository getRepository()
- public boolean contains()
- public EventManager getEventManager()
- public Configuration getConfiguration()
- private void errorIfClosed()
- public bool isOpen()
- public UnitOfWork getUnitOfWork()
- public AbstractHydrator getHydrator()
- public AbstractHydrator newHydrator()
- public ProxyFactory getProxyFactory()
- public void initializeObject()
- public static EntityManager create()
- public FilterCollection getFilters()
- public boolean isFiltersStateClean()
- public True hasFilters()
Hierarchy
Implements
Tasks
Line | Task |
---|---|
649+ | Implementation need. This is necessary since $e2 = clone $e1; throws an E_FATAL when access anything on $e: |
Members
private
- $closed
—
Doctrine\ORM\bool
Whether the EntityManager is closed or not. - $config
—
\Doctrine\ORM\Configuration
The used Configuration. - $conn
—
\Doctrine\DBAL\Connection
The database connection used by the EntityManager. - $eventManager
—
\Doctrine\Common\EventManager
The event manager that is the central point of the event system. - $expressionBuilder
—
\Doctrine\ORM\Query\Expr
The expression builder instance used to generate query expressions. - $filterCollection
—
Doctrine\ORM\Doctrine\ORM\Query\FilterCollection
Collection of query filters. - $hydrators
—
array
The maintained (cached) hydrators. One instance per type. - $metadataFactory
—
\Doctrine\ORM\Mapping\ClassMetadataFactory
The metadata factory, used to retrieve the ORM metadata of entity classes. - $proxyFactory
—
\Doctrine\ORM\Proxy\ProxyFactory
The proxy factory used to create dynamic proxies. - $repositories
—
array
The EntityRepository instances. - $unitOfWork
—
\Doctrine\ORM\UnitOfWork
The UnitOfWork used to coordinate object-level transactions.
Methods
private
- errorIfClosed() — Throws an exception if the EntityManager is closed or currently not active.
public
- beginTransaction() — Starts a transaction on the underlying database connection.
- clear() — Clears the EntityManager. All entities that are currently managed by this EntityManager become detached.
- 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.
- commit() — Commits a transaction on the underlying database connection.
- contains() — Determines whether an entity instance is managed in this EntityManager.
- copy() — Creates a copy of the given entity. Can create a shallow or a deep copy.
- create() — Factory method to create EntityManager instances.
- createNamedNativeQuery() — Creates a NativeQuery from a named native query.
- createNamedQuery() — Creates a Query from a named query.
- createNativeQuery() — Creates a native SQL query.
- createQuery() — Creates a new Query object.
- createQueryBuilder() — Create a QueryBuilder instance
- detach() — Detaches an entity from the EntityManager, causing a managed entity to become detached. Unflushed changes made to the entity if any (including removal of the entity), will not be synchronized to the database.
- find() — Finds an Entity by its identifier.
- flush() — Flushes all changes to objects that have been queued up to now to the database.
- getClassMetadata() — Returns the ORM metadata descriptor for a class.
- getConfiguration() — Gets the Configuration used by the EntityManager.
- getConnection() — Gets the database connection object used by the EntityManager.
- getEventManager() — Gets the EventManager used by the EntityManager.
- getExpressionBuilder() — Gets an ExpressionBuilder used for object-oriented construction of query expressions.
- getFilters() — Gets the enabled filters.
- getHydrator() — Gets a hydrator for the given hydration mode.
- getMetadataFactory() — Gets the metadata factory used to gather the metadata of classes.
- 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.
- getProxyFactory() — Gets the proxy factory used by the EntityManager to create entity proxies.
- 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.
- getRepository() — Gets the repository for an entity class.
- getUnitOfWork() — Gets the UnitOfWork used by the EntityManager to coordinate operations.
- hasFilters() — Checks whether the Entity Manager has filters.
- initializeObject() — Helper method to initialize a lazy loading proxy or persistent collection.
- isFiltersStateClean() — Checks whether the state of the filter collection is clean.
- isOpen() — Check if the Entity manager is open or closed.
- lock() — Acquire a lock on the given entity.
- merge() — Merges the state of a detached entity into the persistence context of this EntityManager and returns the managed copy of the entity.
- newHydrator() — Create a new instance for the given hydration mode.
- persist() — Tells the EntityManager to make an instance managed and persistent.
- refresh() — Refreshes the persistent state of an entity from the database, overriding any local changes that have not yet been persisted.
- remove() — Removes an entity instance.
- rollback() — Performs a rollback on the underlying database connection.
- transactional() — Executes a function in a transaction.