Doctrine/ORM/Filter/Listener/PrivateSharingSubscriber.php
private function buildRequiredOwnerFilter(GetFilterEvent $event, $filter)
    {
        $connection = $event->getConnection();
        $platform = $connection->getDatabasePlatform();
        $targetEntity = $event->getTargetEntity();
        $targetTableAlias = $event->getTargetTableAlias();

        $identifier = DoctrineUtils::castIdentifier($targetEntity, $connection);
        $ownerId = $event->getRealParameter('user_id');
        $ownerColumn = $this->getAssociationColumnName($targetEntity, 'owner');
        $ownerFilter = null !== $ownerId
            ? "{$targetTableAlias}.{$ownerColumn}{$identifier} = {$connection->quote($ownerId)}"
            : "{$platform->getIsNullExpression($targetTableAlias.'.'.$ownerColumn)}";

        return <<<SELECTCLAUSE
{$ownerFilter}
    OR
({$filter})
SELECTCLAUSE;
    }
private function buildRequiredOwnerFilter(GetFilterEvent $event, $filter)
    {
        $connection = $event->getConnection();
        $platform = $connection->getDatabasePlatform();
        $targetEntity = $event->getTargetEntity();
        $targetTableAlias = $event->getTargetTableAlias();

        $identifier = DoctrineUtils::castIdentifier($targetEntity, $connection);
        $ownerId = $event->getRealParameter('user_id');
        $ownerColumn = $this->getAssociationColumnName($targetEntity, 'owner');
        $ownerFilter = null !== $ownerId
            ? "{$targetTableAlias}.{$ownerColumn}{$identifier} = {$connection->quote($ownerId)}"
            : "{$platform->getIsNullExpression($targetTableAlias.'.'.$ownerColumn)}";

        return <<<SELECTCLAUSE
{$ownerFilter}
    OR
({$filter})
SELECTCLAUSE;
    }
private function buildRequiredOwnerFilter ( GetFilterEvent $ event , $ filter ) { $ connection = $ event -> getConnection ( ) ; $ platform = $ connection -> getDatabasePlatform ( ) ; $ targetEntity = $ event -> getTargetEntity ( ) ; $ targetTableAlias = $ event -> getTargetTableAlias ( ) ; $ identifier = DoctrineUtils :: castIdentifier ( $ targetEntity , $ connection ) ; $ ownerId = $ event -> getRealParameter ( 'user_id' ) ; $ ownerColumn = $ this -> getAssociationColumnName ( $ targetEntity , 'owner' ) ; $ ownerFilter = null !== $ ownerId ? "{$targetTableAlias}.{$ownerColumn}{$identifier} = {$connection->quote($ownerId)}" : "{$platform->getIsNullExpression($targetTableAlias.'.'.$ownerColumn)}" ; return  <<<SELECTCLAUSE
{$ownerFilter}
    OR
({$filter})
SELECTCLAUSE ; }
Build the query filter with required owner.

@param GetFilterEvent $event  The event
@param string         $filter The previous filter

@return string
Build the query filter with required owner .