PHP Class AppserverIo\Appserver\PersistenceContainer\Doctrine\DoctrineEntityManagerProxy

Inheritance: implements AppserverIo\RemoteMethodInvocation\RemoteObjectInterface, implements Doctrine\ORM\EntityManagerInterface
Mostrar archivo Open project: appserver-io/appserver Class Usage Examples

Protected Properties

Property Type Description
$className string The class name to proxy.
$session AppserverIo\RemoteMethodInvocation\SessionInterface Holds the ContextSession for this proxy.

Public Methods

Method Description
__call ( string $method, array $params ) : mixed Invokes the remote execution of the passed remote method.
__construct ( mixed $className = 'AppserverIo\Appserver\Core\InitialContext' ) Initializes the proxy with the class name to proxy.
__create ( string $className ) : AppserverIo\RemoteMethodInvocation\RemoteObjectInterface Factory method to create a new instance of the requested proxy implementation.
__getClassName ( ) : string The name of the original object.
__getSession ( ) : AppserverIo\RemoteMethodInvocation\SessionInterface Returns the session instance.
__invoke ( AppserverIo\RemoteMethodInvocation\RemoteMethodInterface $methodCall, AppserverIo\RemoteMethodInvocation\SessionInterface $session ) : mixed Invokes the remote execution of the passed remote method.
__setSession ( AppserverIo\RemoteMethodInvocation\SessionInterface $session ) : AppserverIo\RemoteMethodInvocation\RemoteObjectInterface Sets the session with the connection instance.
beginTransaction ( ) : void Starts a transaction on the underlying database connection.
clear ( string | null $objectName = null ) : 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 ( object $object ) : boolean Checks if the object is part of the current UnitOfWork and therefore managed.
copy ( object $entity, boolean $deep = false ) : object Creates a copy of the given entity. Can create a shallow or a deep copy.
createNamedNativeQuery ( string $name ) : Doctrine\ORM\NativeQuery Creates a NativeQuery from a named native query.
createNamedQuery ( string $name ) : Doctrine\ORM\Query Creates a Query from a named query.
createNativeQuery ( string $sql, Doctrine\ORM\Query\ResultSetMapping $rsm ) : Doctrine\ORM\NativeQuery Creates a native SQL query.
createQuery ( string $dql = '' ) : Query Creates a new Query object.
createQueryBuilder ( ) : Doctrine\ORM\QueryBuilder Create a QueryBuilder instance
detach ( object $object ) : 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 ( string $entityName, mixed $id, integer | null $lockMode = null, integer | null $lockVersion = null ) : object | null Finds an Entity by its identifier.
flush ( null | object | array $entity = null ) : void Flushes all changes to objects that have been queued up to now to the database.
getCache ( ) : Doctrine\ORM\Cache | null Returns the cache API for managing the second level cache regions or NULL if the cache is not enabled.
getClassMetadata ( string $className ) : Doctrine\Common\Persistence\Mapping\ClassMetadata Returns the ClassMetadata descriptor for a class.
getConfiguration ( ) : Doctrine\ORM\Configuration Gets the Configuration used by the EntityManager.
getConnection ( ) : Doctrine\DBAL\Connection Gets the database connection object used by the EntityManager.
getEventManager ( ) : Doctrine\Common\EventManager Gets the EventManager used by the EntityManager.
getExpressionBuilder ( ) : Doctrine\ORM\Query\Expr Gets an ExpressionBuilder used for object-oriented construction of query expressions.
getFilters ( ) : Doctrine\ORM\Query\FilterCollection Gets the enabled filters.
getHydrator ( integer $hydrationMode ) : Doctrine\ORM\Internal\Hydration\AbstractHydrator Gets a hydrator for the given hydration mode.
getMetadataFactory ( ) : Doctrine\Common\Persistence\Mapping\ClassMetadataFactory Gets the metadata factory used to gather the metadata of classes.
getPartialReference ( string $entityName, mixed $identifier ) : object 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 ( ) : Doctrine\ORM\Proxy\ProxyFactory Gets the proxy factory used by the EntityManager to create entity proxies.
getReference ( string $entityName, mixed $id ) : object 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 ( string $className ) : Doctrine\Common\Persistence\ObjectRepository Gets the repository for a class.
getUnitOfWork ( ) : UnitOfWork Gets the UnitOfWork used by the EntityManager to coordinate operations.
hasFilters ( ) : boolean Checks whether the Entity Manager has filters.
initializeObject ( object $obj ) : void Helper method to initialize a lazy loading proxy or persistent collection.
isFiltersStateClean ( ) : boolean Checks whether the state of the filter collection is clean.
isOpen ( ) : boolean Check if the Entity manager is open or closed.
lock ( object $entity, integer $lockMode, integer | null $lockVersion = null ) : void Acquire a lock on the given entity.
merge ( object $object ) : object Merges the state of a detached object into the persistence context of this ObjectManager and returns the managed copy of the object.
newHydrator ( integer $hydrationMode ) : Doctrine\ORM\Internal\Hydration\AbstractHydrator Create a new instance for the given hydration mode.
persist ( object $object ) : void Tells the ObjectManager to make an instance managed and persistent.
refresh ( object $object ) : void Refreshes the persistent state of an object from the database, overriding any local changes that have not yet been persisted.
remove ( object $object ) : void Removes an object instance.
rollback ( ) : void Performs a rollback on the underlying database connection.
transactional ( callable $func ) : mixed Executes a function in a transaction.

Method Details

__call() public method

Invokes the remote execution of the passed remote method.
public __call ( string $method, array $params ) : mixed
$method string The remote method to call
$params array The parameters for the method call
return mixed The result of the remote method call

__construct() public method

Initializes the proxy with the class name to proxy.
public __construct ( mixed $className = 'AppserverIo\Appserver\Core\InitialContext' )
$className mixed The name of the class to create the proxy for

__create() public static method

Factory method to create a new instance of the requested proxy implementation.
public static __create ( string $className ) : AppserverIo\RemoteMethodInvocation\RemoteObjectInterface
$className string The name of the class to create the proxy for
return AppserverIo\RemoteMethodInvocation\RemoteObjectInterface The proxy instance

__getClassName() public method

The name of the original object.
See also: AppserverIo\RemoteMethodInvocation\RemoteObjectInterface::__getClassName()
public __getClassName ( ) : string
return string The name of the original object

__getSession() public method

Returns the session instance.
See also: AppserverIo\RemoteMethodInvocation\RemoteObjectInterface::__getSession()
public __getSession ( ) : AppserverIo\RemoteMethodInvocation\SessionInterface
return AppserverIo\RemoteMethodInvocation\SessionInterface The session instance

__invoke() public method

Invokes the remote execution of the passed remote method.
public __invoke ( AppserverIo\RemoteMethodInvocation\RemoteMethodInterface $methodCall, AppserverIo\RemoteMethodInvocation\SessionInterface $session ) : mixed
$methodCall AppserverIo\RemoteMethodInvocation\RemoteMethodInterface The remote method call instance
$session AppserverIo\RemoteMethodInvocation\SessionInterface The session with the connection instance to use
return mixed The result of the remote method call

__setSession() public method

Sets the session with the connection instance.
public __setSession ( AppserverIo\RemoteMethodInvocation\SessionInterface $session ) : AppserverIo\RemoteMethodInvocation\RemoteObjectInterface
$session AppserverIo\RemoteMethodInvocation\SessionInterface The session instance to use
return AppserverIo\RemoteMethodInvocation\RemoteObjectInterface The instance itself

beginTransaction() public method

Starts a transaction on the underlying database connection.
public beginTransaction ( ) : void
return void

clear() public method

Clears the ObjectManager. All objects that are currently managed by this ObjectManager become detached.
public clear ( string | null $objectName = null ) : void
$objectName string | null if given, only objects of this type will get detached.
return void

close() public method

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 void

commit() public method

Commits a transaction on the underlying database connection.
public commit ( ) : void
return void

contains() public method

Checks if the object is part of the current UnitOfWork and therefore managed.
public contains ( object $object ) : boolean
$object object The object to check
return boolean

copy() public method

Creates a copy of the given entity. Can create a shallow or a deep copy.
public copy ( object $entity, boolean $deep = false ) : object
$entity object The entity to copy.
$deep boolean FALSE for a shallow copy, TRUE for a deep copy.
return object The new entity.

createNamedNativeQuery() public method

Creates a NativeQuery from a named native query.
public createNamedNativeQuery ( string $name ) : Doctrine\ORM\NativeQuery
$name string The query name
return Doctrine\ORM\NativeQuery The query instance

createNamedQuery() public method

Creates a Query from a named query.
public createNamedQuery ( string $name ) : Doctrine\ORM\Query
$name string The query name
return Doctrine\ORM\Query

createNativeQuery() public method

Creates a native SQL query.
public createNativeQuery ( string $sql, Doctrine\ORM\Query\ResultSetMapping $rsm ) : Doctrine\ORM\NativeQuery
$sql string The SQL command
$rsm Doctrine\ORM\Query\ResultSetMapping The ResultSetMapping to use
return Doctrine\ORM\NativeQuery The query instance

createQuery() public method

Creates a new Query object.
public createQuery ( string $dql = '' ) : Query
$dql string The DQL string.
return Query

createQueryBuilder() public method

Create a QueryBuilder instance
public createQueryBuilder ( ) : Doctrine\ORM\QueryBuilder
return Doctrine\ORM\QueryBuilder The query builder instance

detach() public method

Objects which previously referenced the detached object will continue to reference it.
public detach ( object $object ) : void
$object object The object to detach.
return void

find() public method

Finds an Entity by its identifier.
public find ( string $entityName, mixed $id, integer | null $lockMode = null, integer | null $lockVersion = null ) : object | null
$entityName string The class name of the entity to find.
$id mixed The identity of the entity to find.
$lockMode integer | null One of the \Doctrine\DBAL\LockMode::* constants or NULL if no specific lock mode should be used during the search.
$lockVersion integer | null The version of the entity to find when using optimistic locking.
return object | null The entity instance or NULL if the entity can not be found.

flush() public method

This effectively synchronizes the in-memory state of managed objects with the database. If an entity is explicitly passed to this method only this entity and the cascade-persist semantics + scheduled inserts/removals are synchronized.
public flush ( null | object | array $entity = null ) : void
$entity null | object | array The entity to be synchronized
return void

getCache() public method

Returns the cache API for managing the second level cache regions or NULL if the cache is not enabled.
public getCache ( ) : Doctrine\ORM\Cache | null
return Doctrine\ORM\Cache | null

getClassMetadata() public method

The class name must be the fully-qualified class name without a leading backslash (as it is returned by get_class($obj)).
public getClassMetadata ( string $className ) : Doctrine\Common\Persistence\Mapping\ClassMetadata
$className string The class name to return the metadata for
return Doctrine\Common\Persistence\Mapping\ClassMetadata

getConfiguration() public method

Gets the Configuration used by the EntityManager.
public getConfiguration ( ) : Doctrine\ORM\Configuration
return Doctrine\ORM\Configuration The configuration

getConnection() public method

Gets the database connection object used by the EntityManager.
public getConnection ( ) : Doctrine\DBAL\Connection
return Doctrine\DBAL\Connection

getEventManager() public method

Gets the EventManager used by the EntityManager.
public getEventManager ( ) : Doctrine\Common\EventManager
return Doctrine\Common\EventManager The event manager

getExpressionBuilder() public method

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)));
public getExpressionBuilder ( ) : Doctrine\ORM\Query\Expr
return Doctrine\ORM\Query\Expr

getFilters() public method

Gets the enabled filters.
public getFilters ( ) : Doctrine\ORM\Query\FilterCollection
return Doctrine\ORM\Query\FilterCollection The active filter collection

getHydrator() public method

This method caches the hydrator instances which is used for all queries that don't selectively iterate over the result.
Deprecation:
public getHydrator ( integer $hydrationMode ) : Doctrine\ORM\Internal\Hydration\AbstractHydrator
$hydrationMode integer The hydration mode to use
return Doctrine\ORM\Internal\Hydration\AbstractHydrator

getMetadataFactory() public method

Gets the metadata factory used to gather the metadata of classes.
public getMetadataFactory ( ) : Doctrine\Common\Persistence\Mapping\ClassMetadataFactory
return Doctrine\Common\Persistence\Mapping\ClassMetadataFactory

getPartialReference() public method

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.
public getPartialReference ( string $entityName, mixed $identifier ) : object
$entityName string The name of the entity type.
$identifier mixed The entity identifier.
return object The (partial) entity reference.

getProxyFactory() public method

Gets the proxy factory used by the EntityManager to create entity proxies.
public getProxyFactory ( ) : Doctrine\ORM\Proxy\ProxyFactory
return Doctrine\ORM\Proxy\ProxyFactory The proxy factory

getReference() public method

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 ( string $entityName, mixed $id ) : object
$entityName string The name of the entity type.
$id mixed The entity identifier.
return object The entity reference.

getRepository() public method

Gets the repository for a class.
public getRepository ( string $className ) : Doctrine\Common\Persistence\ObjectRepository
$className string The class name to return the repository for
return Doctrine\Common\Persistence\ObjectRepository

getUnitOfWork() public method

Gets the UnitOfWork used by the EntityManager to coordinate operations.
public getUnitOfWork ( ) : UnitOfWork
return Doctrine\ORM\UnitOfWork The unit of work

hasFilters() public method

Checks whether the Entity Manager has filters.
public hasFilters ( ) : boolean
return boolean TRUE, if the EM has a filter collection

initializeObject() public method

This method is a no-op for other objects.
public initializeObject ( object $obj ) : void
$obj object The object to be initialized
return void

isFiltersStateClean() public method

Checks whether the state of the filter collection is clean.
public isFiltersStateClean ( ) : boolean
return boolean TRUE, if the filter collection is clean

isOpen() public method

Check if the Entity manager is open or closed.
public isOpen ( ) : boolean
return boolean TRUE if the EM is open

lock() public method

Acquire a lock on the given entity.
public lock ( object $entity, integer $lockMode, integer | null $lockVersion = null ) : void
$entity object The entity to be locked
$lockMode integer The lock mode
$lockVersion integer | null The lock version
return void

merge() public method

The object passed to merge will not become associated/managed with this ObjectManager.
public merge ( object $object ) : object
$object object The object to be merged
return object The merge instance

newHydrator() public method

Create a new instance for the given hydration mode.
public newHydrator ( integer $hydrationMode ) : Doctrine\ORM\Internal\Hydration\AbstractHydrator
$hydrationMode integer The hydration mode to use
return Doctrine\ORM\Internal\Hydration\AbstractHydrator

persist() public method

The object will be entered into the database as a result of the flush operation. NOTE: The persist operation always considers objects that are not yet known to this ObjectManager as NEW. Do not pass detached objects to the persist operation.
public persist ( object $object ) : void
$object object The instance to make managed and persistent.
return void

refresh() public method

Refreshes the persistent state of an object from the database, overriding any local changes that have not yet been persisted.
public refresh ( object $object ) : void
$object object The object to refresh.
return void

remove() public method

A removed object will be removed from the database as a result of the flush operation.
public remove ( object $object ) : void
$object object The object instance to remove.
return void

rollback() public method

Performs a rollback on the underlying database connection.
public rollback ( ) : void
return void

transactional() public method

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.
public transactional ( callable $func ) : mixed
$func callable The function to execute transactionally.
return mixed The non-empty value returned from the closure or true instead.

Property Details

$className protected_oe property

The class name to proxy.
protected string $className
return string

$session protected_oe property

Holds the ContextSession for this proxy.
protected SessionInterface,AppserverIo\RemoteMethodInvocation $session
return AppserverIo\RemoteMethodInvocation\SessionInterface