Documentation

ManyToManyPersister extends AbstractCollectionPersister
in package

Persister for many-to-many collections.

Tags
psalm-import-type

AssociationMapping from ClassMetadata

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

Methods

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
psalm-param

AssociationMapping $mapping

psalm-return

array{0: string, 1: string}

Return values
array<string|int, string>

ordered tuple:

  • JOIN condition to add to the SQL
  • WHERE condition to add to the SQL

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
psalm-return

array{0: string, 1: list}

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
psalm-return

list

Return values
array<string|int, mixed>

getDeleteSQLParameters()

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
psalm-return

array{0: string, 1: list}

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
psalm-return

list

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
psalm-param

AssociationMapping $mapping

psalm-return

list

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
bool

collectJoinTableColumnParameters()

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
psalm-return

list

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
psalm-return

array{0: string, 1: list, 2: list, 3: list}

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
psalm-return

array{0: string, 1: list, 2: list, 3: list}

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

        
On this page

Search results