class ReadWriteCachedEntityPersister extends AbstractEntityPersister (View source)

Specific read-write entity persister

Properties

protected EntityManagerInterface $em from AbstractEntityPersister
protected ClassMetadataFactory $metadataFactory from AbstractEntityPersister
protected EntityPersister $persister from AbstractEntityPersister
protected ClassMetadata $class from AbstractEntityPersister
protected mixed[][] $queuedCache from AbstractEntityPersister
protected Region $region from AbstractEntityPersister
protected TimestampRegion $timestampRegion from AbstractEntityPersister
protected TimestampCacheKey $timestampKey from AbstractEntityPersister
protected EntityHydrator $hydrator from AbstractEntityPersister
protected Cache $cache from AbstractEntityPersister
protected CacheLogger $cacheLogger from AbstractEntityPersister
protected string $regionName from AbstractEntityPersister
protected string[]|null $joinedAssociations Associations configured as FetchMode::EAGER, as well as all inverse one-to-one associations. from AbstractEntityPersister

Methods

__construct(EntityPersister $persister, Region $region, EntityManagerInterface $em, ClassMetadata $class)

No description

string
getSelectSQL($criteria, AssociationMetadata|null $association = null, $lockMode = null, $limit = null, $offset = null, array $orderBy = [])

Gets the SELECT SQL to select one or more entities by a set of field criteria.

string
getCountSQL(Criteria|mixed[] $criteria = [])

Get the COUNT SQL to count entities (optionally based on a criteria)

getInsertSQL()

{@inheritdoc}

getResultSetMapping()

Gets the ResultSetMapping used for hydration.

string
getSelectConditionStatementSQL($field, $value, AssociationMetadata|null $association = null, $comparison = null)

Gets the SQL WHERE condition for matching a field with a given value.

bool
exists($entity, Criteria|null $extraConditions = null)

Checks whether the given managed entity exists in the database.

getCacheRegion()

Gets the The region access.

bool
storeEntityCache($entity, EntityCacheKey $key)

No description

string
getHash(string $query, string $criteria, array|null $orderBy = null, int $limit = null, int $offset = null)

Generates a string of currently query

mixed[][]
expandParameters(mixed[] $criteria)

Expands the parameters from the given criteria and use the correct binding types if found.

mixed[][]
expandCriteriaParameters(Criteria $criteria)

Expands Criteria Parameters by walking the expressions and grabbing all parameters and types from it.

mixed[]
getManyToManyCollection(ManyToManyAssociationMetadata $association, object $sourceEntity, int|null $offset = null, int|null $limit = null)

Gets (sliced or full) elements of the given collection.

mixed[]
getOneToManyCollection(OneToManyAssociationMetadata $association, object $sourceEntity, int|null $offset = null, int|null $limit = null)

Returns an array with (sliced or full list) of elements in the specified collection.

getOwningTable($fieldName)

{@inheritdoc}

mixed[]
getIdentifier(object $entity)

Extracts the identifier values of an entity that relies on this persister.

setIdentifier(object $entity, array $id)

Populates the entity identifier of an entity.

mixed|null
getColumnValue($entity, string $columnName)

No description

void
insert($entity)

Inserts an entity. Returns any generated post-insert identifiers that were created as a result of the insertion.

object|null
load(array $criteria, object|null $entity = null, AssociationMetadata|null $association = null, array $hints = [], int|null $lockMode = null, int|null $limit = null, array $orderBy = null)

Loads an entity by a list of field criteria.

mixed[]
loadAll(array $criteria = [], array $orderBy = [], int|null $limit = null, int|null $offset = null)

Loads a list of entities by a list of field criteria.

object
loadById(array $identifier, object|null $entity = null)

Loads an entity by identifier.

int
count(Criteria[]|Criteria $criteria = [])

Count entities (optionally filtered by a criteria)

mixed[]
loadCriteria(Criteria $criteria)

Loads Entities matching the given Criteria object.

mixed[]
loadManyToManyCollection(ManyToManyAssociationMetadata $association, object $sourceEntity, PersistentCollection $collection)

Loads a collection of entities of a many-to-many association.

mixed[]
loadOneToManyCollection(OneToManyAssociationMetadata $association, object $sourceEntity, PersistentCollection $collection)

Loads a collection of entities in a one-to-many association.

object
loadToOneEntity(ToOneAssociationMetadata $association, object $sourceEntity, array $identifier = [])

Loads an entity of this persister's mapped class as part of a single-valued association from another entity.

void
lock(array $criteria, int $lockMode)

Locks all rows of this entity matching the given criteria with the specified pessimistic lock mode.

void
refresh(array $id, object $entity, int|null $lockMode = null)

Refreshes a managed entity.

afterTransactionComplete()

Perform whatever processing is encapsulated here after completion of the transaction.

afterTransactionRolledBack()

Perform whatever processing is encapsulated here after completion of the rolled-back.

bool
delete(object $entity)

Deletes a managed entity.

void
update(object $entity)

Updates a managed entity. The entity is updated according to its current changeset in the running UnitOfWork.

Details

__construct(EntityPersister $persister, Region $region, EntityManagerInterface $em, ClassMetadata $class)

Parameters

EntityPersister $persister The entity persister to cache.
Region $region The entity cache region.
EntityManagerInterface $em The entity manager.
ClassMetadata $class The entity metadata.

string getSelectSQL($criteria, AssociationMetadata|null $association = null, $lockMode = null, $limit = null, $offset = null, array $orderBy = [])

Gets the SELECT SQL to select one or more entities by a set of field criteria.

Parameters

$criteria
AssociationMetadata|null $association
$lockMode
$limit
$offset
array $orderBy

Return Value

string

string getCountSQL(Criteria|mixed[] $criteria = [])

Get the COUNT SQL to count entities (optionally based on a criteria)

Parameters

Criteria|mixed[] $criteria

Return Value

string

getInsertSQL()

{@inheritdoc}

ResultSetMapping getResultSetMapping()

Gets the ResultSetMapping used for hydration.

Return Value

ResultSetMapping

string getSelectConditionStatementSQL($field, $value, AssociationMetadata|null $association = null, $comparison = null)

Gets the SQL WHERE condition for matching a field with a given value.

Parameters

$field
$value
AssociationMetadata|null $association
$comparison

Return Value

string

bool exists($entity, Criteria|null $extraConditions = null)

Checks whether the given managed entity exists in the database.

Parameters

$entity
Criteria|null $extraConditions

Return Value

bool TRUE if the entity exists in the database, FALSE otherwise.

Region getCacheRegion()

Gets the The region access.

Return Value

Region

EntityHydrator getEntityHydrator()

Return Value

EntityHydrator

bool storeEntityCache($entity, EntityCacheKey $key)

Parameters

$entity
EntityCacheKey $key

Return Value

bool

protected string getHash(string $query, string $criteria, array|null $orderBy = null, int $limit = null, int $offset = null)

Generates a string of currently query

Parameters

string $query
string $criteria
array|null $orderBy
int $limit
int $offset

Return Value

string

mixed[][] expandParameters(mixed[] $criteria)

Expands the parameters from the given criteria and use the correct binding types if found.

Parameters

mixed[] $criteria

Return Value

mixed[][]

mixed[][] expandCriteriaParameters(Criteria $criteria)

Expands Criteria Parameters by walking the expressions and grabbing all parameters and types from it.

Parameters

Criteria $criteria

Return Value

mixed[][]

ClassMetadata getClassMetadata()

Return Value

ClassMetadata

mixed[] getManyToManyCollection(ManyToManyAssociationMetadata $association, object $sourceEntity, int|null $offset = null, int|null $limit = null)

Gets (sliced or full) elements of the given collection.

Parameters

ManyToManyAssociationMetadata $association The association mapping of the association being loaded.
object $sourceEntity The entity that owns the collection.
int|null $offset
int|null $limit Limit number of results.

Return Value

mixed[]

mixed[] getOneToManyCollection(OneToManyAssociationMetadata $association, object $sourceEntity, int|null $offset = null, int|null $limit = null)

Returns an array with (sliced or full list) of elements in the specified collection.

Parameters

OneToManyAssociationMetadata $association The association mapping of the association being loaded.
object $sourceEntity The entity that owns the collection.
int|null $offset
int|null $limit Limit number of results.

Return Value

mixed[]

getOwningTable($fieldName)

{@inheritdoc}

Parameters

$fieldName

mixed[] getIdentifier(object $entity)

Extracts the identifier values of an entity that relies on this persister.

For composite identifiers, the identifier values are returned as an array with the same order as the field order in {@link ClassMetadata#identifier}.

Parameters

object $entity

Return Value

mixed[]

setIdentifier(object $entity, array $id)

Populates the entity identifier of an entity.

Parameters

object $entity
array $id

mixed|null getColumnValue($entity, string $columnName)

Parameters

$entity
string $columnName

Return Value

mixed|null

void insert($entity)

Inserts an entity. Returns any generated post-insert identifiers that were created as a result of the insertion.

The insertion happens instantaneously.

Subclasses may override this method to customize the semantics of entity deletion.

Parameters

$entity

Return Value

void

object|null load(array $criteria, object|null $entity = null, AssociationMetadata|null $association = null, array $hints = [], int|null $lockMode = null, int|null $limit = null, array $orderBy = null)

Loads an entity by a list of field criteria.

Parameters

array $criteria The criteria by which to load the entity.
object|null $entity The entity to load the data into. If not specified, a new entity is created.
AssociationMetadata|null $association The association that connects the entity to load to another entity, if any.
array $hints Hints for entity creation.
int|null $lockMode One of the \Doctrine\DBAL\LockMode::* constants or NULL if no specific lock mode should be used for loading the entity.
int|null $limit Limit number of results.
array $orderBy Criteria to order by.

Return Value

object|null The loaded and managed entity instance or NULL if the entity can not be found.

mixed[] loadAll(array $criteria = [], array $orderBy = [], int|null $limit = null, int|null $offset = null)

Loads a list of entities by a list of field criteria.

Parameters

array $criteria
array $orderBy
int|null $limit Limit number of results.
int|null $offset

Return Value

mixed[]

object loadById(array $identifier, object|null $entity = null)

Loads an entity by identifier.

Parameters

array $identifier The entity identifier.
object|null $entity The entity to load the data into. If not specified, a new entity is created.

Return Value

object The loaded and managed entity instance or NULL if the entity can not be found.

int count(Criteria[]|Criteria $criteria = [])

Count entities (optionally filtered by a criteria)

Parameters

Criteria[]|Criteria $criteria

Return Value

int

mixed[] loadCriteria(Criteria $criteria)

Loads Entities matching the given Criteria object.

Parameters

Criteria $criteria

Return Value

mixed[]

mixed[] loadManyToManyCollection(ManyToManyAssociationMetadata $association, object $sourceEntity, PersistentCollection $collection)

Loads a collection of entities of a many-to-many association.

Parameters

ManyToManyAssociationMetadata $association The association mapping of the association being loaded.
object $sourceEntity The entity that owns the collection.
PersistentCollection $collection The collection to load/fill.

Return Value

mixed[]

mixed[] loadOneToManyCollection(OneToManyAssociationMetadata $association, object $sourceEntity, PersistentCollection $collection)

Loads a collection of entities in a one-to-many association.

Parameters

OneToManyAssociationMetadata $association The association mapping of the association being loaded.
object $sourceEntity The entity that owns the collection.
PersistentCollection $collection The collection to load/fill.

Return Value

mixed[]

object loadToOneEntity(ToOneAssociationMetadata $association, object $sourceEntity, array $identifier = [])

Loads an entity of this persister's mapped class as part of a single-valued association from another entity.

Parameters

ToOneAssociationMetadata $association The association to load.
object $sourceEntity The entity that owns the association (not necessarily the "owning side").
array $identifier The identifier of the entity to load. Must be provided if the association to load represents the owning side, otherwise the identifier is derived from the $sourceEntity.

Return Value

object The loaded and managed entity instance or NULL if the entity can not be found.

Exceptions

MappingException

void lock(array $criteria, int $lockMode)

Locks all rows of this entity matching the given criteria with the specified pessimistic lock mode.

Parameters

array $criteria
int $lockMode One of the Doctrine\DBAL\LockMode::* constants.

Return Value

void

void refresh(array $id, object $entity, int|null $lockMode = null)

Refreshes a managed entity.

Parameters

array $id The identifier of the entity as an associative array from column or field names to values.
object $entity The entity to refresh.
int|null $lockMode One of the \Doctrine\DBAL\LockMode::* constants or NULL if no specific lock mode should be used for refreshing the managed entity.

Return Value

void

protected CollectionCacheKey buildCollectionCacheKey(AssociationMetadata $association, $ownerId)

Parameters

AssociationMetadata $association
$ownerId

Return Value

CollectionCacheKey

afterTransactionComplete()

Perform whatever processing is encapsulated here after completion of the transaction.

afterTransactionRolledBack()

Perform whatever processing is encapsulated here after completion of the rolled-back.

bool delete(object $entity)

Deletes a managed entity.

The entity to delete must be managed and have a persistent identifier. The deletion happens instantaneously.

Subclasses may override this method to customize the semantics of entity deletion.

Parameters

object $entity The entity to delete.

Return Value

bool TRUE if the entity got deleted in the database, FALSE otherwise.

void update(object $entity)

Updates a managed entity. The entity is updated according to its current changeset in the running UnitOfWork.

If there is no changeset, nothing is updated.

Subclasses may override this method to customize the semantics of entity update.

Parameters

object $entity The entity to update.

Return Value

void