PHP Class Doctrine\Search\UnitOfWork

Datei anzeigen Open project: doctrine/search Class Usage Examples

Public Methods

Method Description
__construct ( Doctrine\Search\SearchManager $sm ) Initializes a new UnitOfWork instance, bound to the given SearchManager.
clear ( string $entityName = null ) Clears the UnitOfWork.
commit ( null | object | array $entity = null ) Commits the UnitOfWork, executing all operations that have been postponed up to this point.
hydrateCollection ( array $classes, Traversable $resultSet ) Construct an entity collection
hydrateEntity ( ClassMetadata $class, object $document ) Construct an entity object
isInIdentityMap ( object $entity ) : boolean Checks whether an entity is registered in the identity map of this UnitOfWork.
load ( ClassMetadata $class, mixed $value, array $options = [] ) Load and hydrate a document model
loadCollection ( array $classes, unknown $query ) Load and hydrate a document collection
persist ( object $entity ) Persists an entity as part of the current unit of work.
remove ( object $entity ) Deletes an entity as part of the current unit of work.

Private Methods

Method Description
commitPersisted ( ) Commit persisted entities to the database
commitRemoved ( ) Commit deleted entities to the database
sortObjects ( array $objects, boolean $serialize = true ) : array Prepare entities for commit. Entities scheduled for deletion do not need to be serialized.

Method Details

__construct() public method

Initializes a new UnitOfWork instance, bound to the given SearchManager.
public __construct ( Doctrine\Search\SearchManager $sm )
$sm Doctrine\Search\SearchManager

clear() public method

Clears the UnitOfWork.
public clear ( string $entityName = null )
$entityName string if given, only entities of this type will get detached

commit() public method

The operations are executed in the following order: 1) All entity inserts 2) All entity deletions
public commit ( null | object | array $entity = null )
$entity null | object | array

hydrateCollection() public method

Construct an entity collection
public hydrateCollection ( array $classes, Traversable $resultSet )
$classes array
$resultSet Traversable

hydrateEntity() public method

Construct an entity object
public hydrateEntity ( ClassMetadata $class, object $document )
$class Doctrine\Search\Mapping\ClassMetadata
$document object

isInIdentityMap() public method

Checks whether an entity is registered in the identity map of this UnitOfWork.
public isInIdentityMap ( object $entity ) : boolean
$entity object
return boolean

load() public method

Load and hydrate a document model
public load ( ClassMetadata $class, mixed $value, array $options = [] )
$class Doctrine\Search\Mapping\ClassMetadata
$value mixed
$options array

loadCollection() public method

Load and hydrate a document collection
public loadCollection ( array $classes, unknown $query )
$classes array
$query unknown

persist() public method

Persists an entity as part of the current unit of work.
public persist ( object $entity )
$entity object The entity to persist.

remove() public method

Deletes an entity as part of the current unit of work.
public remove ( object $entity )
$entity object The entity to remove.