<?php

namespace BW\BlogBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * PostRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class PostRepository extends EntityRepository {
    
    public function findNestedBy($left, $right) {
        $qb = $this->createQueryBuilder('p')
                ->innerJoin('p.category', 'c')
                ->innerJoin('p.route', 'r')
                ->innerJoin('p.lang', 'l')
                ->where('p.published = 1')
                ->andWhere('c.published = 1')
                ->andWhere('c.left >= :left')
                ->andWhere('c.left <= :right')
                ->setParameter('left', $left)
                ->setParameter('right', $right)
                ->orderBy('p.created', 'DESC')
            ;
        
        if (isset($_GET['form'])) {
            $qb = $qb
                    ->innerJoin('p.customFieldProperties', 'cfp')
                    ->andWhere('cfp.id IN ('. implode(',', $_GET['form']['properteis']) .') ')
                    //->andWhere('cfp.id IN (:properties)')
                    //->setParameter('properties', implode(',', $_GET['form']['properteis']))
                ;
        }
        
        return $qb->getQuery()->getResult();
    }
    
}

<?php

namespace BW\BlogBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * PostRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class PostRepository extends EntityRepository {
    
    public function findNestedBy($left, $right) {
        $request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
        
        $qb = $this->createQueryBuilder('p')
                ->innerJoin('p.category', 'c')
                ->innerJoin('p.route', 'r')
                ->innerJoin('p.lang', 'l')
                ->where('p.published = 1')
                ->andWhere('c.published = 1')
                ->andWhere('c.left >= :left')
                ->andWhere('c.left <= :right')
                ->setParameter('left', $left)
                ->setParameter('right', $right)
                ->orderBy('p.created', 'DESC')
            ;
        
        /* Custom Filter */
        $form = $request->query->get('form', FALSE);
        if ($form) {
            if (isset($form['properteis'])) {
                $qb = $qb
                        ->innerJoin('p.customFieldProperties', 'cfp')
                        ->andWhere('cfp.id IN (:properties)')
                        ->setParameter('properties', $form['properteis'])
                    ;
            }
        }
        /* /Custom Filter */
        
        return $qb->getQuery()->getResult();
    }
    
}

Improve IN clause in WHERE
Improve IN clause in WHERE
