Doctrine/ORM/Provider/SharingProvider.php
private function addWhereSecurityIdentitiesForSharing(QueryBuilder $qb, array $sids)
    {
        if (!empty($sids) && !empty($groupSids = $this->groupSecurityIdentities($sids))) {
            $where = '';
            $parameters = [];
            $i = 0;

            foreach ($groupSids as $type => $identifiers) {
                $qClass = 'sid'.$i.'_class';
                $qIdentifiers = 'sid'.$i.'_ids';
                $parameters[$qClass] = $type;
                $parameters[$qIdentifiers] = $identifiers;
                $where .= '' === $where ? '' : ' OR ';
                $where .= sprintf('(s.identityClass = :%s AND s.identityName IN (:%s))', $qClass, $qIdentifiers);
                ++$i;
            }

            $qb->andWhere($where);

            foreach ($parameters as $key => $identifiers) {
                $qb->setParameter($key, $identifiers);
            }
        }

        return $qb;
    }
private function addWhereSecurityIdentitiesForSharing(QueryBuilder $qb, array $sids)
    {
        if (!empty($sids) && !empty($groupSids = $this->groupSecurityIdentities($sids))) {
            $where = '';
            $parameters = [];
            $i = 0;

            foreach ($groupSids as $type => $identifiers) {
                $qClass = 'sid'.$i.'_class';
                $qIdentifiers = 'sid'.$i.'_ids';
                $parameters[$qClass] = $type;
                $parameters[$qIdentifiers] = $identifiers;
                $where .= '' === $where ? '' : ' OR ';
                $where .= sprintf('(s.identityClass = :%s AND s.identityName IN (:%s))', $qClass, $qIdentifiers);
                ++$i;
            }

            $qb->andWhere($where);

            foreach ($parameters as $key => $identifiers) {
                $qb->setParameter($key, $identifiers);
            }
        }

        return $qb;
    }
private function addWhereSecurityIdentitiesForSharing ( QueryBuilder $ qb , array $ sids ) { if ( ! empty ( $ sids ) && ! empty ( $ groupSids = $ this -> groupSecurityIdentities ( $ sids ) ) ) { $ where = '' ; $ parameters = [ ] ; $ i = 0 ; foreach ( $ groupSids as $ type => $ identifiers ) { $ qClass = 'sid' . $ i . '_class' ; $ qIdentifiers = 'sid' . $ i . '_ids' ; $ parameters [ $ qClass ] = $ type ; $ parameters [ $ qIdentifiers ] = $ identifiers ; $ where .= '' === $ where ? '' : ' OR ' ; $ where .= sprintf ( '(s.identityClass = :%s AND s.identityName IN (:%s))' , $ qClass , $ qIdentifiers ) ; ++ $ i ; } $ qb -> andWhere ( $ where ) ; foreach ( $ parameters as $ key => $ identifiers ) { $ qb -> setParameter ( $ key , $ identifiers ) ; } } return $ qb ; }
Add security identities where condition for sharing.

@param QueryBuilder                $qb   The query builder
@param SecurityIdentityInterface[] $sids The security identities

@return QueryBuilder
Add security identities where condition for sharing .