ManyToManyPersister
extends AbstractCollectionPersister
in package
Persister for many-to-many collections.
Tags
Table of Contents
Properties
- $conn : Connection
- $em : EntityManagerInterface
- $platform : AbstractPlatform
- The database platform.
- $quoteStrategy : QuoteStrategy
- $uow : UnitOfWork
Methods
- __construct() : mixed
- Initializes a new instance of a class derived from AbstractCollectionPersister.
- contains() : mixed
- {@inheritDoc}
- containsKey() : mixed
- {@inheritDoc}
- count() : mixed
- {@inheritDoc}
- delete() : mixed
- {@inheritDoc}
- get() : mixed
- {@inheritDoc}
- getFilterSql() : array<string|int, string>
- Generates the filter SQL for a given mapping.
- loadCriteria() : mixed
- {@inheritDoc}
- slice() : mixed
- {@inheritDoc}
- update() : mixed
- {@inheritDoc}
- generateFilterConditionSQL() : string
- Generates the filter SQL for a given entity and table alias.
- getDeleteRowSQL() : array<string|int, string>|array<string|int, array<string|int, string>>
- Gets the SQL statement used for deleting a row from the collection.
- getDeleteRowSQLParameters() : array<string|int, mixed>
- Gets the SQL parameters for the corresponding SQL statement to delete the given element from the given collection.
- getDeleteSQL() : string
- getDeleteSQLParameters() : array<int, mixed>
- Internal note: Order of the parameters must be the same as the order of the columns in getDeleteSql.
- getInsertRowSQL() : array<string|int, string>|array<string|int, array<string|int, string>>
- Gets the SQL statement used for inserting a row in the collection.
- getInsertRowSQLParameters() : array<string|int, mixed>
- Gets the SQL parameters for the corresponding SQL statement to insert the given element of the given collection into the database.
- getOnConditionSQL() : array<string|int, string>
- Generate ON condition
- isValidEntityState() : bool
- Check if entity is in a valid state for operations.
- collectJoinTableColumnParameters() : array<string|int, mixed>
- Collects the parameters for inserting/deleting on the join table in the order of the join table columns as specified in ManyToManyMapping#joinTableColumns.
- expandCriteriaParameters() : array<string|int, array<string|int, mixed>>
- Expands Criteria Parameters by walking the expressions and grabbing all parameters and types from it.
- getJoinTableRestrictions() : array<string|int, mixed>
- getJoinTableRestrictionsWithKey() : array<string|int, mixed>
- getLimitSql() : string
- getOrderingSql() : string
Properties
$conn
protected
Connection
$conn
$em
protected
EntityManagerInterface
$em
$platform
The database platform.
protected
AbstractPlatform
$platform
$quoteStrategy
protected
QuoteStrategy
$quoteStrategy
$uow
protected
UnitOfWork
$uow
Methods
__construct()
Initializes a new instance of a class derived from AbstractCollectionPersister.
public
__construct(EntityManagerInterface $em) : mixed
Parameters
- $em : EntityManagerInterface
contains()
{@inheritDoc}
public
contains(PersistentCollection $collection, mixed $element) : mixed
Parameters
- $collection : PersistentCollection
- $element : mixed
containsKey()
{@inheritDoc}
public
containsKey(PersistentCollection $collection, mixed $key) : mixed
Parameters
- $collection : PersistentCollection
- $key : mixed
count()
{@inheritDoc}
public
count(PersistentCollection $collection) : mixed
Parameters
- $collection : PersistentCollection
delete()
{@inheritDoc}
public
delete(PersistentCollection $collection) : mixed
Parameters
- $collection : PersistentCollection
get()
{@inheritDoc}
public
get(PersistentCollection $collection, mixed $index) : mixed
Parameters
- $collection : PersistentCollection
- $index : mixed
getFilterSql()
Generates the filter SQL for a given mapping.
public
getFilterSql(array<string|int, mixed> $mapping) : array<string|int, string>
This method is not used for actually grabbing the related entities but when the extra-lazy collection methods are called on a filtered association. This is why besides the many to many table we also have to join in the actual entities table leading to additional JOIN.
Parameters
- $mapping : array<string|int, mixed>
-
Array containing mapping information.
Tags
Return values
array<string|int, string> —ordered tuple:
- JOIN condition to add to the SQL
- WHERE condition to add to the SQL
loadCriteria()
{@inheritDoc}
public
loadCriteria(PersistentCollection $collection, Criteria $criteria) : mixed
Parameters
- $collection : PersistentCollection
- $criteria : Criteria
slice()
{@inheritDoc}
public
slice(PersistentCollection $collection, mixed $offset[, mixed $length = null ]) : mixed
Parameters
- $collection : PersistentCollection
- $offset : mixed
- $length : mixed = null
update()
{@inheritDoc}
public
update(PersistentCollection $collection) : mixed
Parameters
- $collection : PersistentCollection
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.
getDeleteRowSQL()
Gets the SQL statement used for deleting a row from the collection.
protected
getDeleteRowSQL(PersistentCollection $collection) : array<string|int, string>|array<string|int, array<string|int, string>>
Parameters
- $collection : PersistentCollection
Tags
Return values
array<string|int, string>|array<string|int, array<string|int, string>> —ordered tuple containing the SQL to be executed and an array of types for bound parameters
getDeleteRowSQLParameters()
Gets the SQL parameters for the corresponding SQL statement to delete the given element from the given collection.
protected
getDeleteRowSQLParameters(PersistentCollection $collection, mixed $element) : array<string|int, mixed>
Internal note: Order of the parameters must be the same as the order of the columns in getDeleteRowSql.
Parameters
- $collection : PersistentCollection
- $element : mixed
Tags
Return values
array<string|int, mixed>getDeleteSQL()
protected
getDeleteSQL(PersistentCollection $collection) : string
Parameters
- $collection : PersistentCollection
Return values
stringgetDeleteSQLParameters()
Internal note: Order of the parameters must be the same as the order of the columns in getDeleteSql.
protected
getDeleteSQLParameters(PersistentCollection $collection) : array<int, mixed>
Parameters
- $collection : PersistentCollection
Return values
array<int, mixed>getInsertRowSQL()
Gets the SQL statement used for inserting a row in the collection.
protected
getInsertRowSQL(PersistentCollection $collection) : array<string|int, string>|array<string|int, array<string|int, string>>
Parameters
- $collection : PersistentCollection
Tags
Return values
array<string|int, string>|array<string|int, array<string|int, string>> —ordered tuple containing the SQL to be executed and an array of types for bound parameters
getInsertRowSQLParameters()
Gets the SQL parameters for the corresponding SQL statement to insert the given element of the given collection into the database.
protected
getInsertRowSQLParameters(PersistentCollection $collection, object $element) : array<string|int, mixed>
Internal note: Order of the parameters must be the same as the order of the columns in getInsertRowSql.
Parameters
- $collection : PersistentCollection
- $element : object
Tags
Return values
array<string|int, mixed>getOnConditionSQL()
Generate ON condition
protected
getOnConditionSQL(array<string|int, mixed> $mapping) : array<string|int, string>
Parameters
- $mapping : array<string|int, mixed>
Tags
Return values
array<string|int, string>isValidEntityState()
Check if entity is in a valid state for operations.
protected
isValidEntityState(object $entity) : bool
Parameters
- $entity : object
Return values
boolcollectJoinTableColumnParameters()
Collects the parameters for inserting/deleting on the join table in the order of the join table columns as specified in ManyToManyMapping#joinTableColumns.
private
collectJoinTableColumnParameters(PersistentCollection $collection, object $element) : array<string|int, mixed>
Parameters
- $collection : PersistentCollection
- $element : object
Tags
Return values
array<string|int, mixed>expandCriteriaParameters()
Expands Criteria Parameters by walking the expressions and grabbing all parameters and types from it.
private
expandCriteriaParameters(Criteria $criteria) : array<string|int, array<string|int, mixed>>
Parameters
- $criteria : Criteria
Return values
array<string|int, array<string|int, mixed>>getJoinTableRestrictions()
private
getJoinTableRestrictions(PersistentCollection $collection, object $element, bool $addFilters) : array<string|int, mixed>
Parameters
- $collection : PersistentCollection
- $element : object
- $addFilters : bool
-
Whether the filter SQL should be included or not.
Tags
Return values
array<string|int, mixed> —ordered vector:
- quoted join table name
- where clauses to be added for filtering
- parameters to be bound for filtering
- types of the parameters to be bound for filtering
getJoinTableRestrictionsWithKey()
private
getJoinTableRestrictionsWithKey(PersistentCollection $collection, string $key, bool $addFilters) : array<string|int, mixed>
Parameters
- $collection : PersistentCollection
- $key : string
- $addFilters : bool
-
Whether the filter SQL should be included or not.
Tags
Return values
array<string|int, mixed> —ordered vector:
- quoted join table name
- where clauses to be added for filtering
- parameters to be bound for filtering
- types of the parameters to be bound for filtering
getLimitSql()
private
getLimitSql(Criteria $criteria) : string
Parameters
- $criteria : Criteria
Tags
Return values
stringgetOrderingSql()
private
getOrderingSql(Criteria $criteria, ClassMetadata $targetClass) : string
Parameters
- $criteria : Criteria
- $targetClass : ClassMetadata