Doctrine/ORM/Listener/SharingDeleteListener.php
private function buildCriteria(QueryBuilder $qb, array $mapIds, $fieldClass, $fieldId): void
    {
        if (!empty($mapIds)) {
            $where = '';
            $parameters = [];
            $i = 0;

            foreach ($mapIds as $type => $identifiers) {
                $pClass = $fieldClass.'_'.$i;
                $pIdentifiers = $fieldId.'s_'.$i;
                $parameters[$pClass] = $type;
                $parameters[$pIdentifiers] = $identifiers;
                $where .= '' === $where ? '' : ' OR ';
                $where .= sprintf('(s.%s = :%s AND s.%s IN (:%s))', $fieldClass, $pClass, $fieldId, $pIdentifiers);
                ++$i;
            }

            $qb->andWhere($where);

            foreach ($parameters as $key => $identifiers) {
                $qb->setParameter($key, $identifiers);
            }
        }
    }
private function buildCriteria(QueryBuilder $qb, array $mapIds, $fieldClass, $fieldId): void
    {
        if (!empty($mapIds)) {
            $where = '';
            $parameters = [];
            $i = 0;

            foreach ($mapIds as $type => $identifiers) {
                $pClass = $fieldClass.'_'.$i;
                $pIdentifiers = $fieldId.'s_'.$i;
                $parameters[$pClass] = $type;
                $parameters[$pIdentifiers] = $identifiers;
                $where .= '' === $where ? '' : ' OR ';
                $where .= sprintf('(s.%s = :%s AND s.%s IN (:%s))', $fieldClass, $pClass, $fieldId, $pIdentifiers);
                ++$i;
            }

            $qb->andWhere($where);

            foreach ($parameters as $key => $identifiers) {
                $qb->setParameter($key, $identifiers);
            }
        }
    }
private function buildCriteria ( QueryBuilder $ qb , array $ mapIds , $ fieldClass , $ fieldId ) : void { if ( ! empty ( $ mapIds ) ) { $ where = '' ; $ parameters = [ ] ; $ i = 0 ; foreach ( $ mapIds as $ type => $ identifiers ) { $ pClass = $ fieldClass . '_' . $ i ; $ pIdentifiers = $ fieldId . 's_' . $ i ; $ parameters [ $ pClass ] = $ type ; $ parameters [ $ pIdentifiers ] = $ identifiers ; $ where .= '' === $ where ? '' : ' OR ' ; $ where .= sprintf ( '(s.%s = :%s AND s.%s IN (:%s))' , $ fieldClass , $ pClass , $ fieldId , $ pIdentifiers ) ; ++ $ i ; } $ qb -> andWhere ( $ where ) ; foreach ( $ parameters as $ key => $ identifiers ) { $ qb -> setParameter ( $ key , $ identifiers ) ; } } }
Build the query criteria.

@param QueryBuilder $qb         The query builder
@param array        $mapIds     The map of classname and identifiers
@param string       $fieldClass The name of field class
@param string       $fieldId    The name of field identifier
Build the query criteria .