protected function addFilterToQueryBuilder(array $filter, QueryBuilder $queryBuilder)
    {
        $objectManager    = $this->getObjectManager();
        $entityClassAlias = $this->getEntityClassAlias();
        $classMetaData    = $objectManager->getClassMetadata($this->getEntityClass());
        $assocMappings    = $classMetaData->getAssociationMappings();

        $andExpressions = array();
        $paramCounter   = 0;

        foreach ($filter as $property => $value) {
            if (empty($value)) {
                continue;
            }

            if (!isset($assocMappings[$property])) {
                throw new \InvalidArgumentException('Unkown association "' . $property . '"');
            }
            $paramCounter++;
            $queryBuilder->andWhere($queryBuilder->expr()->eq($entityClassAlias . '.' .$property, '?' . $paramCounter));
            $queryBuilder->setParameter($paramCounter, $value);

        }

        return $paramCounter;
    }
protected function addFilterToQueryBuilder(array $filter, QueryBuilder $queryBuilder)
    {
        $objectManager    = $this->getObjectManager();
        $entityClassAlias = $this->getEntityClassAlias();
        $classMetaData    = $objectManager->getClassMetadata($this->getEntityClass());
        $assocMappings    = $classMetaData->getAssociationMappings();

        $andExpressions = array();
        $paramCounter   = 0;

        foreach ($filter as $property => $value) {
            if (empty($value)) {
                continue;
            }

            if (!isset($assocMappings[$property])) {
                throw new \InvalidArgumentException('Unkown association "' . $property . '"');
            }
            $paramCounter++;
            $queryBuilder->andWhere($queryBuilder->expr()->eq($entityClassAlias . '.' .$property, '?' . $paramCounter));
            $queryBuilder->setParameter($paramCounter, $value);

        }

        return $paramCounter;
    }
protected function addFilterToQueryBuilder ( array $ filter , QueryBuilder $ queryBuilder ) { $ objectManager = $ this -> getObjectManager ( ) ; $ entityClassAlias = $ this -> getEntityClassAlias ( ) ; $ classMetaData = $ objectManager -> getClassMetadata ( $ this -> getEntityClass ( ) ) ; $ assocMappings = $ classMetaData -> getAssociationMappings ( ) ; $ andExpressions = array ( ) ; $ paramCounter = 0 ; foreach ( $ filter as $ property => $ value ) { if ( empty ( $ value ) ) { continue ; } if ( ! isset ( $ assocMappings [ $ property ] ) ) { throw new \ InvalidArgumentException ( 'Unkown association "' . $ property . '"' ) ; } $ paramCounter ++ ; $ queryBuilder -> andWhere ( $ queryBuilder -> expr ( ) -> eq ( $ entityClassAlias . '.' . $ property , '?' . $ paramCounter ) ) ; $ queryBuilder -> setParameter ( $ paramCounter , $ value ) ; } return $ paramCounter ; }
Adds filter conditions to query bilder

@param array $filter
@param QueryBuilder $queryBuilder
@throws \InvalidArgumentException
@return integer
Adds filter conditions to query bilder