BasicEntityPersister
in package
implements
EntityPersister
A BasicEntityPersister maps an entity to a single table in a relational database.
A persister is always responsible for a single entity type.
EntityPersisters are used during a UnitOfWork to apply any changes to the persistent state of entities onto a relational database when the UnitOfWork is committed, as well as for basic querying of entities and their associations (not DQL).
The persisting operations that are invoked during a commit of a UnitOfWork to persist the persistent entity state are:
- : To schedule an entity for insertion.
- : To execute all scheduled insertions.
- : To update the persistent state of an entity.
- : To delete the persistent state of an entity.
As can be seen from the above list, insertions are batched and executed all at once for increased efficiency.
The querying operations invoked during a UnitOfWork, either through direct find requests or lazy-loading, are the following:
- : Loads (the state of) a single, managed entity.
- : Loads multiple, managed entities.
- : Loads a one/many-to-one entity association (lazy-loading).
- : Loads a one-to-many entity association (lazy-loading).
- : Loads a many-to-many entity association (lazy-loading).
The BasicEntityPersister implementation provides the default behavior for persisting and querying entities that are mapped to a single database table.
Subclasses can be created to provide custom persisting and querying strategies, i.e. spanning multiple tables.
Interfaces, Classes, Traits and Enums
- EntityPersister
- Entity persister interface Define the behavior that should be implemented by all entity persisters.
Table of Contents
- $class : ClassMetadata
- Metadata object that describes the mapping of the mapped entity class.
- $columnTypes : array<string|int, mixed>
- The map of column names to DBAL mapping types of all prepared columns used when INSERTing or UPDATEing an entity.
- $conn : Connection
- The underlying DBAL Connection of the used EntityManager.
- $currentPersisterContext : CachedPersisterContext
- $em : EntityManagerInterface
- The EntityManager instance.
- $platform : AbstractPlatform
- The database platform.
- $queuedInserts : mixed
- Queued inserts.
- $quotedColumns : array<string|int, mixed>
- The map of quoted column names.
- $quoteStrategy : QuoteStrategy
- The quote strategy.
- $comparisonMap : array<string, string>
- $identifierFlattener : IdentifierFlattener
- The IdentifierFlattener used for manipulating identifiers
- $insertSql : string
- The INSERT SQL statement used for entities handled by this persister.
- $limitsHandlingContext : CachedPersisterContext
- $noLimitsContext : CachedPersisterContext
- __construct() : mixed
- Initializes a new <tt>BasicEntityPersister</tt> that uses the given EntityManager and persists instances of the class described by the given ClassMetadata descriptor.
- addInsert() : void
- Adds an entity to the queued insertions.
- count() : int
- Count entities (optionally filtered by a criteria)
- delete() : bool
- Deletes a managed entity.
- executeInserts() : mixed
- Executes all queued entity insertions and returns any generated post-insert identifiers that were created as a result of the insertions.
- exists() : bool
- Checks whether the given managed entity exists in the database.
- expandCriteriaParameters() : mixed
- Expands Criteria Parameters by walking the expressions and grabbing all parameters and types from it.
- expandParameters() : mixed
- Expands the parameters from the given criteria and use the correct binding types if found.
- getClassMetadata() : ClassMetadata
- getCountSQL() : string
- Get the COUNT SQL to count entities (optionally based on a criteria)
- getInserts() : mixed
- Get all queued inserts.
- getInsertSQL() : string
- getManyToManyCollection() : array<string|int, mixed>
- Gets (sliced or full) elements of the given collection.
- getOneToManyCollection() : array<string|int, mixed>
- Returns an array with (sliced or full list) of elements in the specified collection.
- getOwningTable() : string
- Gets the name of the table that owns the column the given field is mapped to.
- getResultSetMapping() : ResultSetMapping
- Gets the ResultSetMapping used for hydration.
- getSelectConditionStatementSQL() : string
- Gets the SQL WHERE condition for matching a field with a given value.
- getSelectSQL() : string
- Gets the SELECT SQL to select one or more entities by a set of field criteria.
- getSQLColumnAlias() : string
- load() : object|null
- Loads an entity by a list of field criteria.
- loadAll() : mixed
- Loads a list of entities by a list of field criteria.
- loadById() : object|null
- Loads an entity by identifier.
- loadCriteria() : array<string|int, mixed>
- Loads Entities matching the given Criteria object.
- loadManyToManyCollection() : array<string|int, mixed>
- Loads a collection of entities of a many-to-many association.
- loadOneToManyCollection() : mixed
- Loads a collection of entities in a one-to-many association.
- loadOneToOneEntity() : object
- Loads an entity of this persister's mapped class as part of a single-valued association from another entity.
- lock() : void
- Locks all rows of this entity matching the given criteria with the specified pessimistic lock mode.
- refresh() : void
- Refreshes a managed entity.
- update() : void
- 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.
- assignDefaultVersionValue() : void
- Retrieves the default version value which was created by the preceding INSERT statement and assigns it back in to the entities version field.
- deleteJoinTableRecords() : void
- fetchVersionValue() : mixed
- Fetches the current version value of a versioned entity.
- generateFilterConditionSQL() : string
- Generates the filter SQL for a given entity and table alias.
- getClassIdentifiersTypes() : array<string|int, string>
- getInsertColumnList() : array<string|int, string>
- Gets the list of columns to put in the INSERT SQL statement.
- getJoinSQLForJoinColumns() : string
- Generates the appropriate join SQL for the given join column.
- getLockTablesSql() : string
- Gets the FROM and optionally JOIN conditions to lock the entity managed by this persister.
- getOrderBySQL() : string
- Gets the ORDER BY SQL snippet for ordered collections.
- getSelectColumnAssociationSQL() : string
- Gets the SQL join fragment used when selecting entities from an association.
- getSelectColumnSQL() : string
- Gets the SQL snippet of a qualified column name for the given field name.
- getSelectColumnsSQL() : string
- Gets the SQL fragment with the list of columns to select when querying for an entity in this persister.
- getSelectConditionCriteriaSQL() : string
- Gets the Select Where Condition from a Criteria object.
- getSelectConditionSQL() : string
- Gets the conditional SQL fragment used in the WHERE clause when selecting entities in this persister.
- getSelectManyToManyJoinSQL() : string
- Gets the SQL join fragment used when selecting entities from a many-to-many association.
- getSQLTableAlias() : string
- Gets the SQL table alias for the given class name.
- prepareInsertData() : array<string|int, array<string|int, mixed>>
- Prepares the data changeset of a managed entity for database insertion (initial INSERT).
- prepareUpdateData() : array<string|int, array<string|int, mixed>>
- Prepares the changeset of an entity for database insertion (UPDATE).
- switchPersisterContext() : void
- Switches persister context according to current query offset/limits
- updateTable() : void
- Performs an UPDATE statement for an entity on a specific table.
- expandToManyParameters() : array<string|int, array<string|int, mixed>>
- Expands the parameters from the given criteria and use the correct binding types if found, specialized for OneToMany or ManyToMany associations.
- extractIdentifierTypes() : array<string|int, int>|array<string|int, null>|array<string|int, string>
- getIndividualValue() : mixed
- Retrieves an individual parameter value.
- getManyToManyStatement() : Result
- getOneToManyStatement() : Result
- Builds criteria and execute SQL statement to fetch the one to many entities from.
- getSelectConditionStatementColumnSQL() : array<string|int, string>
- Builds the left-hand-side of a where condition statement.
- getTypes() : array<string|int, int>|array<string|int, null>|array<string|int, string>
- Infers field types to be used by parameter type casting.
- getValues() : array<string|int, mixed>
- Retrieves the parameters that identifies a value.
- loadArrayFromResult() : array<string|int, mixed>
- Loads an array of entities from a given DBAL statement.
- loadCollectionFromStatement() : array<string|int, mixed>
- Hydrates a collection from a given DBAL statement.
Properties
$class
Metadata object that describes the mapping of the mapped entity class.
protected
ClassMetadata
$class
$columnTypes
The map of column names to DBAL mapping types of all prepared columns used when INSERTing or UPDATEing an entity.
protected
array<string|int, mixed>
$columnTypes
= []
Tags
$conn
The underlying DBAL Connection of the used EntityManager.
protected
Connection
$conn
$currentPersisterContext
protected
CachedPersisterContext
$currentPersisterContext
$em
The EntityManager instance.
protected
EntityManagerInterface
$em
$platform
The database platform.
protected
AbstractPlatform
$platform
$queuedInserts
Queued inserts.
protected
mixed
$queuedInserts
= []
Tags
$quotedColumns
The map of quoted column names.
protected
array<string|int, mixed>
$quotedColumns
= []
Tags
$quoteStrategy
The quote strategy.
protected
QuoteStrategy
$quoteStrategy
$comparisonMap
private
static array<string, string>
$comparisonMap
= [\Doctrine\Common\Collections\Expr\Comparison::EQ => '= %s', \Doctrine\Common\Collections\Expr\Comparison::NEQ => '!= %s', \Doctrine\Common\Collections\Expr\Comparison::GT => '> %s', \Doctrine\Common\Collections\Expr\Comparison::GTE => '>= %s', \Doctrine\Common\Collections\Expr\Comparison::LT => '< %s', \Doctrine\Common\Collections\Expr\Comparison::LTE => '<= %s', \Doctrine\Common\Collections\Expr\Comparison::IN => 'IN (%s)', \Doctrine\Common\Collections\Expr\Comparison::NIN => 'NOT IN (%s)', \Doctrine\Common\Collections\Expr\Comparison::CONTAINS => 'LIKE %s', \Doctrine\Common\Collections\Expr\Comparison::STARTS_WITH => 'LIKE %s', \Doctrine\Common\Collections\Expr\Comparison::ENDS_WITH => 'LIKE %s']
$identifierFlattener
The IdentifierFlattener used for manipulating identifiers
private
IdentifierFlattener
$identifierFlattener
$insertSql
The INSERT SQL statement used for entities handled by this persister.
private
string
$insertSql
This SQL is only generated once per request, if at all.
$limitsHandlingContext
private
CachedPersisterContext
$limitsHandlingContext
$noLimitsContext
private
CachedPersisterContext
$noLimitsContext
Methods
__construct()
Initializes a new <tt>BasicEntityPersister</tt> that uses the given EntityManager and persists instances of the class described by the given ClassMetadata descriptor.
public
__construct(EntityManagerInterface $em, ClassMetadata $class) : mixed
Parameters
- $em : EntityManagerInterface
- $class : ClassMetadata
Return values
mixed —addInsert()
Adds an entity to the queued insertions.
public
addInsert(mixed $entity) : void
Parameters
- $entity : mixed
-
The entity to queue for insertion.
Return values
void —count()
Count entities (optionally filtered by a criteria)
public
count([mixed $criteria = [] ]) : int
Parameters
- $criteria : mixed = []
Return values
int —delete()
Deletes a managed entity.
public
delete(mixed $entity) : bool
Parameters
- $entity : mixed
-
The entity to delete.
Return values
bool —TRUE if the entity got deleted in the database, FALSE otherwise.
executeInserts()
Executes all queued entity insertions and returns any generated post-insert identifiers that were created as a result of the insertions.
public
executeInserts() : mixed
Return values
mixed —exists()
Checks whether the given managed entity exists in the database.
public
exists(mixed $entity[, Criteria|null $extraConditions = null ]) : bool
Parameters
- $entity : mixed
- $extraConditions : Criteria|null = null
Return values
bool —TRUE if the entity exists in the database, FALSE otherwise.
expandCriteriaParameters()
Expands Criteria Parameters by walking the expressions and grabbing all parameters and types from it.
public
expandCriteriaParameters(Criteria $criteria) : mixed
Parameters
- $criteria : Criteria
Return values
mixed —expandParameters()
Expands the parameters from the given criteria and use the correct binding types if found.
public
expandParameters(mixed $criteria) : mixed
Parameters
- $criteria : mixed
Return values
mixed —getClassMetadata()
public
getClassMetadata() : ClassMetadata
Return values
ClassMetadata —getCountSQL()
Get the COUNT SQL to count entities (optionally based on a criteria)
public
getCountSQL([mixed $criteria = [] ]) : string
Parameters
- $criteria : mixed = []
Return values
string —getInserts()
Get all queued inserts.
public
getInserts() : mixed
Return values
mixed —getInsertSQL()
public
getInsertSQL() : string
Return values
string —getManyToManyCollection()
Gets (sliced or full) elements of the given collection.
public
getManyToManyCollection(array<string|int, mixed> $assoc, mixed $sourceEntity[, mixed $offset = null ][, mixed $limit = null ]) : array<string|int, mixed>
Parameters
- $assoc : array<string|int, mixed>
- $sourceEntity : mixed
- $offset : mixed = null
- $limit : mixed = null
Return values
array<string|int, mixed> —getOneToManyCollection()
Returns an array with (sliced or full list) of elements in the specified collection.
public
getOneToManyCollection(array<string|int, mixed> $assoc, mixed $sourceEntity[, mixed $offset = null ][, mixed $limit = null ]) : array<string|int, mixed>
Parameters
- $assoc : array<string|int, mixed>
- $sourceEntity : mixed
- $offset : mixed = null
- $limit : mixed = null
Return values
array<string|int, mixed> —getOwningTable()
Gets the name of the table that owns the column the given field is mapped to.
public
getOwningTable(mixed $fieldName) : string
Parameters
- $fieldName : mixed
-
The field name.
Return values
string —The table name.
getResultSetMapping()
Gets the ResultSetMapping used for hydration.
public
getResultSetMapping() : ResultSetMapping
Return values
ResultSetMapping —getSelectConditionStatementSQL()
Gets the SQL WHERE condition for matching a field with a given value.
public
getSelectConditionStatementSQL(mixed $field, mixed $value[, mixed $assoc = null ][, mixed $comparison = null ]) : string
Parameters
- $field : mixed
- $value : mixed
- $assoc : mixed = null
- $comparison : mixed = null
Return values
string —getSelectSQL()
Gets the SELECT SQL to select one or more entities by a set of field criteria.
public
getSelectSQL(mixed $criteria[, mixed $assoc = null ][, mixed $lockMode = null ][, mixed $limit = null ][, mixed $offset = null ][, array<string|int, mixed>|null $orderBy = null ]) : string
Parameters
- $criteria : mixed
- $assoc : mixed = null
- $lockMode : mixed = null
- $limit : mixed = null
- $offset : mixed = null
- $orderBy : array<string|int, mixed>|null = null
Return values
string —getSQLColumnAlias()
public
getSQLColumnAlias(string $columnName) : string
Parameters
- $columnName : string
Return values
string —load()
Loads an entity by a list of field criteria.
public
load(array<string|int, mixed> $criteria[, mixed $entity = null ][, mixed $assoc = null ][, array<string|int, mixed> $hints = [] ][, mixed $lockMode = null ][, mixed $limit = null ][, array<string|int, mixed>|null $orderBy = null ]) : object|null
Parameters
- $criteria : array<string|int, mixed>
-
The criteria by which to load the entity.
- $entity : mixed = null
-
The entity to load the data into. If not specified, a new entity is created.
- $assoc : mixed = null
-
The association that connects the entity to load to another entity, if any.
- $hints : array<string|int, mixed> = []
-
Hints for entity creation.
- $lockMode : mixed = null
-
One of the \Doctrine\DBAL\LockMode::* constants or NULL if no specific lock mode should be used for loading the entity.
- $limit : mixed = null
-
Limit number of results.
- $orderBy : array<string|int, mixed>|null = null
-
Criteria to order by.
Return values
object|null —The loaded and managed entity instance or NULL if the entity can not be found.
loadAll()
Loads a list of entities by a list of field criteria.
public
loadAll([array<string|int, mixed> $criteria = [] ][, array<string|int, mixed>|null $orderBy = null ][, mixed $limit = null ][, mixed $offset = null ]) : mixed
Parameters
- $criteria : array<string|int, mixed> = []
- $orderBy : array<string|int, mixed>|null = null
- $limit : mixed = null
- $offset : mixed = null
Return values
mixed —loadById()
Loads an entity by identifier.
public
loadById(array<string|int, mixed> $identifier[, mixed $entity = null ]) : object|null
Parameters
- $identifier : array<string|int, mixed>
- $entity : mixed = null
-
The entity to load the data into. If not specified, a new entity is created.
Return values
object|null —The loaded and managed entity instance or NULL if the entity can not be found.
loadCriteria()
Loads Entities matching the given Criteria object.
public
loadCriteria(Criteria $criteria) : array<string|int, mixed>
Parameters
- $criteria : Criteria
Return values
array<string|int, mixed> —loadManyToManyCollection()
Loads a collection of entities of a many-to-many association.
public
loadManyToManyCollection(array<string|int, mixed> $assoc, mixed $sourceEntity, PersistentCollection $collection) : array<string|int, mixed>
Parameters
- $assoc : array<string|int, mixed>
- $sourceEntity : mixed
-
The entity that owns the collection.
- $collection : PersistentCollection
-
The collection to fill.
Return values
array<string|int, mixed> —loadOneToManyCollection()
Loads a collection of entities in a one-to-many association.
public
loadOneToManyCollection(array<string|int, mixed> $assoc, mixed $sourceEntity, PersistentCollection $collection) : mixed
Parameters
- $assoc : array<string|int, mixed>
- $sourceEntity : mixed
- $collection : PersistentCollection
-
The collection to load/fill.
Return values
mixed —loadOneToOneEntity()
Loads an entity of this persister's mapped class as part of a single-valued association from another entity.
public
loadOneToOneEntity(array<string|int, mixed> $assoc, mixed $sourceEntity[, array<string|int, mixed> $identifier = [] ]) : object
Parameters
- $assoc : array<string|int, mixed>
- $sourceEntity : mixed
-
The entity that owns the association (not necessarily the "owning side").
- $identifier : array<string|int, mixed> = []
Return values
object —The loaded and managed entity instance or NULL if the entity can not be found.
lock()
Locks all rows of this entity matching the given criteria with the specified pessimistic lock mode.
public
lock(array<string|int, mixed> $criteria, mixed $lockMode) : void
Parameters
- $criteria : array<string|int, mixed>
- $lockMode : mixed
-
One of the Doctrine\DBAL\LockMode::* constants.
Return values
void —refresh()
Refreshes a managed entity.
public
refresh(array<string|int, mixed> $id, mixed $entity[, mixed $lockMode = null ]) : void
Parameters
- $id : array<string|int, mixed>
- $entity : mixed
-
The entity to refresh.
- $lockMode : mixed = null
-
One of the \Doctrine\DBAL\LockMode::* constants or NULL if no specific lock mode should be used for refreshing the managed entity.
Return values
void —update()
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.
public
update(mixed $entity) : void
Parameters
- $entity : mixed
-
The entity to update.
Return values
void —assignDefaultVersionValue()
Retrieves the default version value which was created by the preceding INSERT statement and assigns it back in to the entities version field.
protected
assignDefaultVersionValue(object $entity, array<string|int, mixed> $id) : void
Parameters
- $entity : object
- $id : array<string|int, mixed>
Return values
void —deleteJoinTableRecords()
protected
deleteJoinTableRecords(array<string|int, mixed> $identifier, array<string|int, string> $types) : void
Parameters
- $identifier : array<string|int, mixed>
- $types : array<string|int, string>
Tags
Return values
void —fetchVersionValue()
Fetches the current version value of a versioned entity.
protected
fetchVersionValue(ClassMetadata $versionedClass, array<string|int, mixed> $id) : mixed
Parameters
- $versionedClass : ClassMetadata
- $id : array<string|int, mixed>
Return values
mixed —generateFilterConditionSQL()
Generates the filter SQL for a given entity and table alias.
protected
generateFilterConditionSQL(ClassMetadata $targetEntity, string $targetTableAlias) : string
Parameters
- $targetEntity : ClassMetadata
-
Metadata of the target entity.
- $targetTableAlias : string
-
The table alias of the joined/selected table.
Return values
string —The SQL query part to add to a query.
getClassIdentifiersTypes()
protected
getClassIdentifiersTypes(ClassMetadata $class) : array<string|int, string>
Parameters
- $class : ClassMetadata
Tags
Return values
array<string|int, string> —getInsertColumnList()
Gets the list of columns to put in the INSERT SQL statement.
protected
getInsertColumnList() : array<string|int, string>
Subclasses should override this method to alter or change the list of columns placed in the INSERT statements used by the persister.
Tags
Return values
array<string|int, string> —The list of columns.
getJoinSQLForJoinColumns()
Generates the appropriate join SQL for the given join column.
protected
getJoinSQLForJoinColumns(array<string|int, array<string|int, mixed>> $joinColumns) : string
Parameters
- $joinColumns : array<string|int, array<string|int, mixed>>
-
The join columns definition of an association.
Tags
Return values
string —LEFT JOIN if one of the columns is nullable, INNER JOIN otherwise.
getLockTablesSql()
Gets the FROM and optionally JOIN conditions to lock the entity managed by this persister.
protected
getLockTablesSql(int|null $lockMode) : string
Parameters
- $lockMode : int|null
-
One of the Doctrine\DBAL\LockMode::* constants.
Return values
string —getOrderBySQL()
Gets the ORDER BY SQL snippet for ordered collections.
protected
final getOrderBySQL(array<string|int, mixed> $orderBy, string $baseTableAlias) : string
Parameters
- $orderBy : array<string|int, mixed>
- $baseTableAlias : string
Tags
Return values
string —getSelectColumnAssociationSQL()
Gets the SQL join fragment used when selecting entities from an association.
protected
getSelectColumnAssociationSQL(string $field, array<string|int, mixed> $assoc, ClassMetadata $class[, string $alias = 'r' ]) : string
Parameters
- $field : string
- $assoc : array<string|int, mixed>
- $class : ClassMetadata
- $alias : string = 'r'
Return values
string —getSelectColumnSQL()
Gets the SQL snippet of a qualified column name for the given field name.
protected
getSelectColumnSQL(string $field, ClassMetadata $class[, string $alias = 'r' ]) : string
Parameters
- $field : string
-
The field name.
- $class : ClassMetadata
-
The class that declares this field. The table this class is mapped to must own the column for the given field.
- $alias : string = 'r'
Return values
string —getSelectColumnsSQL()
Gets the SQL fragment with the list of columns to select when querying for an entity in this persister.
protected
getSelectColumnsSQL() : string
Subclasses should override this method to alter or change the select column list SQL fragment. Note that in the implementation of BasicEntityPersister the resulting SQL fragment is generated only once and cached in . Subclasses may or may not do the same.
Return values
string —The SQL fragment.
getSelectConditionCriteriaSQL()
Gets the Select Where Condition from a Criteria object.
protected
getSelectConditionCriteriaSQL(Criteria $criteria) : string
Parameters
- $criteria : Criteria
Return values
string —getSelectConditionSQL()
Gets the conditional SQL fragment used in the WHERE clause when selecting entities in this persister.
protected
getSelectConditionSQL(array<string|int, mixed> $criteria[, array<string|int, mixed>|null $assoc = null ]) : string
Subclasses are supposed to override this method if they intend to change or alter the criteria by which entities are selected.
Parameters
- $criteria : array<string|int, mixed>
- $assoc : array<string|int, mixed>|null = null
Tags
Return values
string —getSelectManyToManyJoinSQL()
Gets the SQL join fragment used when selecting entities from a many-to-many association.
protected
getSelectManyToManyJoinSQL(array<string|int, mixed> $manyToMany) : string
Parameters
- $manyToMany : array<string|int, mixed>
Tags
Return values
string —getSQLTableAlias()
Gets the SQL table alias for the given class name.
protected
getSQLTableAlias(string $className[, string $assocName = '' ]) : string
Parameters
- $className : string
- $assocName : string = ''
Tags
Return values
string —The SQL table alias.
prepareInsertData()
Prepares the data changeset of a managed entity for database insertion (initial INSERT).
protected
prepareInsertData(object $entity) : array<string|int, array<string|int, mixed>>
The changeset of the entity is obtained from the currently running UnitOfWork.
The default insert data preparation is the same as for updates.
Parameters
- $entity : object
-
The entity for which to prepare the data.
Tags
Return values
array<string|int, array<string|int, mixed>> —The prepared data for the tables to update.
prepareUpdateData()
Prepares the changeset of an entity for database insertion (UPDATE).
protected
prepareUpdateData(object $entity) : array<string|int, array<string|int, mixed>>
The changeset is obtained from the currently running UnitOfWork.
During this preparation the array that is passed as the second parameter is filled with
<columnName> =>
Example:
array(
'foo_table' => array('column1' => 'value1', 'column2' => 'value2', ...),
'bar_table' => array('columnX' => 'valueX', 'columnY' => 'valueY', ...),
...
)
Parameters
- $entity : object
-
The entity for which to prepare the data.
Tags
Return values
array<string|int, array<string|int, mixed>> —The prepared data.
switchPersisterContext()
Switches persister context according to current query offset/limits
protected
switchPersisterContext(int|null $offset, int|null $limit) : void
This is due to the fact that to-many associations cannot be fetch-joined when a limit is involved
Parameters
- $offset : int|null
- $limit : int|null
Return values
void —updateTable()
Performs an UPDATE statement for an entity on a specific table.
protected
final updateTable(object $entity, string $quotedTableName, array<string|int, mixed> $updateData[, bool $versioned = false ]) : void
The UPDATE can optionally be versioned, which requires the entity to have a version field.
Parameters
- $entity : object
-
The entity object being updated.
- $quotedTableName : string
-
The quoted name of the table to apply the UPDATE on.
- $updateData : array<string|int, mixed>
-
The map of columns to update (column => value).
- $versioned : bool = false
-
Whether the UPDATE should be versioned.
Tags
Return values
void —expandToManyParameters()
Expands the parameters from the given criteria and use the correct binding types if found, specialized for OneToMany or ManyToMany associations.
private
expandToManyParameters(array<string|int, array<string|int, mixed>> $criteria) : array<string|int, array<string|int, mixed>>
Parameters
- $criteria : array<string|int, array<string|int, mixed>>
-
an array of arrays containing following:
- field to which each criterion will be bound
- value to be bound
- class to which the field belongs to
Tags
Return values
array<string|int, array<string|int, mixed>> —extractIdentifierTypes()
private
extractIdentifierTypes(array<string|int, mixed> $id, ClassMetadata $versionedClass) : array<string|int, int>|array<string|int, null>|array<string|int, string>
Parameters
- $id : array<string|int, mixed>
- $versionedClass : ClassMetadata
Tags
Return values
array<string|int, int>|array<string|int, null>|array<string|int, string> —getIndividualValue()
Retrieves an individual parameter value.
private
getIndividualValue(mixed $value) : mixed
Parameters
- $value : mixed
Return values
mixed —getManyToManyStatement()
private
getManyToManyStatement(array<string|int, mixed> $assoc, object $sourceEntity[, int|null $offset = null ][, int|null $limit = null ]) : Result
Parameters
- $assoc : array<string|int, mixed>
- $sourceEntity : object
- $offset : int|null = null
- $limit : int|null = null
Tags
Return values
Result —getOneToManyStatement()
Builds criteria and execute SQL statement to fetch the one to many entities from.
private
getOneToManyStatement(array<string|int, mixed> $assoc, object $sourceEntity[, int|null $offset = null ][, int|null $limit = null ]) : Result
Parameters
- $assoc : array<string|int, mixed>
- $sourceEntity : object
- $offset : int|null = null
- $limit : int|null = null
Tags
Return values
Result —getSelectConditionStatementColumnSQL()
Builds the left-hand-side of a where condition statement.
private
getSelectConditionStatementColumnSQL(string $field[, array<string|int, mixed>|null $assoc = null ]) : array<string|int, string>
Parameters
- $field : string
- $assoc : array<string|int, mixed>|null = null
Tags
Return values
array<string|int, string> —getTypes()
Infers field types to be used by parameter type casting.
private
getTypes(string $field, mixed $value, ClassMetadata $class) : array<string|int, int>|array<string|int, null>|array<string|int, string>
Parameters
- $field : string
- $value : mixed
- $class : ClassMetadata
Tags
Return values
array<string|int, int>|array<string|int, null>|array<string|int, string> —getValues()
Retrieves the parameters that identifies a value.
private
getValues(mixed $value) : array<string|int, mixed>
Parameters
- $value : mixed
Return values
array<string|int, mixed> —loadArrayFromResult()
Loads an array of entities from a given DBAL statement.
private
loadArrayFromResult(array<string|int, mixed> $assoc, Result $stmt) : array<string|int, mixed>
Parameters
- $assoc : array<string|int, mixed>
- $stmt : Result
Return values
array<string|int, mixed> —loadCollectionFromStatement()
Hydrates a collection from a given DBAL statement.
private
loadCollectionFromStatement(array<string|int, mixed> $assoc, Result $stmt, PersistentCollection $coll) : array<string|int, mixed>
Parameters
- $assoc : array<string|int, mixed>
- $stmt : Result
- $coll : PersistentCollection