PHP Class Doctrine\OXM\XmlEntityManager

Inheritance: implements Doctrine\Common\Persistence\ObjectManager
Show file Open project: doctrine/oxm Class Usage Examples

Public Methods

Method Description
__construct ( Doctrine\OXM\Storage\Storage $storage, Configuration $config, Doctrine\Common\EventManager $eventManager = null ) Creates a new XmlEntityManager that uses the given Configuration and EventManager implementations.
clear ( string $entityName = null ) 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.
detach ( object $entity ) Detaches an entity from the XmlEntityManager, 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 filesystem.
find ( string $entityName, mixed $identifier, integer $lockMode = LockMode::NONE, integer $lockVersion = null ) : object Finds an Entity by its identifier.
flush ( ) Flushes all changes to objects that have been queued up to now to the filesystem.
getClassMetadata ( $className ) : ClassMetadata Returns the OXM mapping descriptor for a class.
getConfiguration ( ) : Configuration
getEventManager ( ) : Doctrine\Common\EventManager
getMarshaller ( ) : Doctrine\OXM\Marshaller\Marshaller\Marshaller
getMetadataFactory ( ) : ClassMetadataFactory Gets the metadata factory used to gather the metadata of classes.
getProxyFactory ( ) : ProxyFactory Gets the proxy factory used by the XmlEntityManager to create xml-entity proxies.
getRepository ( string $entityName ) : Doctrine\Common\Persistence\ObjectRepository Gets the repository for a class.
getStorage ( ) : Doctrine\OXM\Storage\XmlStorage
getUnitOfWork ( ) : UnitOfWork Gets the UnitOfWork used by the EntityManager to coordinate operations.
isOpen ( ) : boolean Check if the Entity manager is open or closed.
marshal ( object $object ) : string Marshals a mapped object into XML
merge ( object $entity ) : object Merges the state of a detached entity into the persistence context of this XmlEntityManager and returns the managed copy of the entity.
persist ( $entity ) Tells the XmlEntityManager to make an instance managed and persistent.
refresh ( object $entity ) Refreshes the persistent state of an entity from the filesystem, overriding any local changes that have not yet been persisted.
remove ( object $entity ) Removes an entity instance.
unmarshal ( string $xml ) : object Unmarshals XML into mapped objects

Private Methods

Method Description
errorIfClosed ( ) Throws an exception if the EntityManager is closed or currently not active.

Method Details

__construct() public method

Creates a new XmlEntityManager that uses the given Configuration and EventManager implementations.
public __construct ( Doctrine\OXM\Storage\Storage $storage, Configuration $config, Doctrine\Common\EventManager $eventManager = null )
$storage Doctrine\OXM\Storage\Storage
$config Configuration
$eventManager Doctrine\Common\EventManager

clear() public method

Clears the EntityManager. All entities that are currently managed by this EntityManager become detached.
public clear ( string $entityName = null )
$entityName string

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 ( )

detach() public method

Entities which previously referenced the detached entity will continue to reference it.
public detach ( object $entity )
$entity object The entity to detach.

find() public method

This is just a convenient shortcut for getRepository($entityName)->find($id).
public find ( string $entityName, mixed $identifier, integer $lockMode = LockMode::NONE, integer $lockVersion = null ) : object
$entityName string
$identifier mixed
$lockMode integer
$lockVersion integer
return object

flush() public method

This effectively synchronizes the in-memory state of managed objects with the filesystem.
public flush ( )

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)) or an aliased class name. Examples: MyProject\Domain\User sales:PriceRequest
public getClassMetadata ( $className ) : ClassMetadata
return Doctrine\OXM\Mapping\ClassMetadata

getConfiguration() public method

public getConfiguration ( ) : Configuration
return Configuration

getEventManager() public method

public getEventManager ( ) : Doctrine\Common\EventManager
return Doctrine\Common\EventManager

getMarshaller() public method

public getMarshaller ( ) : Doctrine\OXM\Marshaller\Marshaller\Marshaller
return Doctrine\OXM\Marshaller\Marshaller\Marshaller

getMetadataFactory() public method

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

getProxyFactory() public method

Gets the proxy factory used by the XmlEntityManager to create xml-entity proxies.
public getProxyFactory ( ) : ProxyFactory
return Doctrine\OXM\Proxy\ProxyFactory

getRepository() public method

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

getStorage() public method

public getStorage ( ) : Doctrine\OXM\Storage\XmlStorage
return Doctrine\OXM\Storage\XmlStorage

getUnitOfWork() public method

Gets the UnitOfWork used by the EntityManager to coordinate operations.
public getUnitOfWork ( ) : UnitOfWork
return UnitOfWork

isOpen() public method

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

marshal() public method

Marshals a mapped object into XML
public marshal ( object $object ) : string
$object object
return string

merge() public method

The entity passed to merge will not become associated/managed with this XmlEntityManager.
public merge ( object $entity ) : object
$entity object The detached entity to merge into the persistence context.
return object The managed copy of the entity.

persist() public method

The entity will be entered into the filesystem at or before transaction commit or as a result of the flush operation. NOTE: The persist operation always considers entities that are not yet known to this XmlEntityManager as NEW. Do not pass detached entities to the persist operation.
public persist ( $entity )

refresh() public method

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

remove() public method

A removed entity will be removed from the filesystem at or before transaction commit or as a result of the flush operation.
public remove ( object $entity )
$entity object The entity instance to remove.

unmarshal() public method

Unmarshals XML into mapped objects
public unmarshal ( string $xml ) : object
$xml string
return object