class ManyToManyPersister extends AbstractCollectionPersister (View source)

Persister for many-to-many collections.

Properties

protected EntityManagerInterface $em from AbstractCollectionPersister
protected Connection $conn from AbstractCollectionPersister
protected UnitOfWork $uow from AbstractCollectionPersister
protected AbstractPlatform $platform The database platform. from AbstractCollectionPersister
protected QuoteStrategy $quoteStrategy The quote strategy. from AbstractCollectionPersister

Methods

__construct(EntityManagerInterface $em)

Initializes a new instance of a class derived from AbstractCollectionPersister.

bool
isValidEntityState(object $entity)

Check if entity is in a valid state for operations.

void
delete(PersistentCollection $collection)

Deletes the persistent state represented by the given collection.

void
update(PersistentCollection $collection)

Updates the given collection, synchronizing its state with the database by inserting, updating and deleting individual elements.

mixed
get(PersistentCollection $collection, mixed $index)

Gets an element by key.

integer
count(PersistentCollection $collection)

Counts the size of this persistent collection.

array
slice(PersistentCollection $collection, integer $offset, integer $length = null)

Slices elements.

boolean
containsKey(PersistentCollection $collection, mixed $key)

Checks for existence of a key.

boolean
contains(PersistentCollection $collection, object $element)

Checks for existence of an element.

mixed
removeElement(PersistentCollection $collection, object $element)

Removes an element.

array
loadCriteria(PersistentCollection $collection, Criteria $criteria)

Loads association entities matching the given Criteria object.

string[]
getFilterSql(array $mapping)

Generates the filter SQL for a given mapping.

string
generateFilterConditionSQL(ClassMetadata $targetEntity, string $targetTableAlias)

Generates the filter SQL for a given entity and table alias.

array
getOnConditionSQL(array $mapping)

Generate ON condition

getDeleteSQL(PersistentCollection $collection)

{@inheritdoc}

getDeleteSQLParameters(PersistentCollection $collection)

{@inheritdoc}

string[]|string[][]
getDeleteRowSQL(PersistentCollection $collection)

Gets the SQL statement used for deleting a row from the collection.

array
getDeleteRowSQLParameters(PersistentCollection $collection, mixed $element)

Gets the SQL parameters for the corresponding SQL statement to delete the given element from the given collection.

string[]|string[][]
getInsertRowSQL(PersistentCollection $collection)

Gets the SQL statement used for inserting a row in the collection.

array
getInsertRowSQLParameters(PersistentCollection $collection, mixed $element)

Gets the SQL parameters for the corresponding SQL statement to insert the given element of the given collection into the database.

Details

__construct(EntityManagerInterface $em)

Initializes a new instance of a class derived from AbstractCollectionPersister.

Parameters

EntityManagerInterface $em

protected bool isValidEntityState(object $entity)

Check if entity is in a valid state for operations.

Parameters

object $entity

Return Value

bool

void delete(PersistentCollection $collection)

Deletes the persistent state represented by the given collection.

Parameters

PersistentCollection $collection

Return Value

void

void update(PersistentCollection $collection)

Updates the given collection, synchronizing its state with the database by inserting, updating and deleting individual elements.

Parameters

PersistentCollection $collection

Return Value

void

mixed get(PersistentCollection $collection, mixed $index)

Gets an element by key.

Parameters

PersistentCollection $collection
mixed $index

Return Value

mixed

integer count(PersistentCollection $collection)

Counts the size of this persistent collection.

Parameters

PersistentCollection $collection

Return Value

integer

array slice(PersistentCollection $collection, integer $offset, integer $length = null)

Slices elements.

Parameters

PersistentCollection $collection
integer $offset
integer $length

Return Value

array

boolean containsKey(PersistentCollection $collection, mixed $key)

Checks for existence of a key.

Parameters

PersistentCollection $collection
mixed $key

Return Value

boolean

boolean contains(PersistentCollection $collection, object $element)

Checks for existence of an element.

Parameters

PersistentCollection $collection
object $element

Return Value

boolean

mixed removeElement(PersistentCollection $collection, object $element)

Removes an element.

Parameters

PersistentCollection $collection
object $element

Return Value

mixed

array loadCriteria(PersistentCollection $collection, Criteria $criteria)

Loads association entities matching the given Criteria object.

Parameters

PersistentCollection $collection
Criteria $criteria

Return Value

array

string[] getFilterSql(array $mapping)

Generates the filter SQL for a given mapping.

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

array $mapping Array containing mapping information.

Return Value

string[] ordered tuple: - JOIN condition to add to the SQL - WHERE condition to add to the SQL

protected string generateFilterConditionSQL(ClassMetadata $targetEntity, string $targetTableAlias)

Generates the filter SQL for a given entity and table alias.

Parameters

ClassMetadata $targetEntity Metadata of the target entity.
string $targetTableAlias The table alias of the joined/selected table.

Return Value

string The SQL query part to add to a query.

protected array getOnConditionSQL(array $mapping)

Generate ON condition

Parameters

array $mapping

Return Value

array

protected getDeleteSQL(PersistentCollection $collection)

{@inheritdoc}

Parameters

PersistentCollection $collection

protected getDeleteSQLParameters(PersistentCollection $collection)

{@inheritdoc}

Internal note: Order of the parameters must be the same as the order of the columns in getDeleteSql.

Parameters

PersistentCollection $collection

protected string[]|string[][] getDeleteRowSQL(PersistentCollection $collection)

Gets the SQL statement used for deleting a row from the collection.

Parameters

PersistentCollection $collection

Return Value

string[]|string[][] ordered tuple containing the SQL to be executed and an array of types for bound parameters

protected array getDeleteRowSQLParameters(PersistentCollection $collection, mixed $element)

Gets the SQL parameters for the corresponding SQL statement to delete the given element from the given collection.

Internal note: Order of the parameters must be the same as the order of the columns in getDeleteRowSql.

Parameters

PersistentCollection $collection
mixed $element

Return Value

array

protected string[]|string[][] getInsertRowSQL(PersistentCollection $collection)

Gets the SQL statement used for inserting a row in the collection.

Parameters

PersistentCollection $collection

Return Value

string[]|string[][] ordered tuple containing the SQL to be executed and an array of types for bound parameters

protected array getInsertRowSQLParameters(PersistentCollection $collection, mixed $element)

Gets the SQL parameters for the corresponding SQL statement to insert the given element of the given collection into the database.

Internal note: Order of the parameters must be the same as the order of the columns in getInsertRowSql.

Parameters

PersistentCollection $collection
mixed $element

Return Value

array