// check if the requested criteria is restricted (limit, offset, sorting, filtering)
if ($this->
isAssociationRestricted($criteria,
$association->
getPropertyName())) { // if restricted load paginated list of many to many
$this->
loadManyToManyWithCriteria($associationCriteria,
$association,
$context,
$collection,
$partial);
return;
} // otherwise the association is loaded in the root query of the entity as sub select which contains all ids
// the ids are extracted in the entity hydrator (see: \Shopware\Core\Framework\DataAbstractionLayer\Dbal\EntityHydrator::extractManyToManyIds)
$this->
loadManyToManyOverExtension($associationCriteria,
$association,
$context,
$collection,
$partial);
} private function addManyToManySelect( EntityDefinition
$definition,
string
$root,
ManyToManyAssociationField
$field,
QueryBuilder
$query,
Context
$context ): void
{ $mapping =
$field->
getMappingDefinition();