public function expand(FilterBuilder $filterBuilder, $value, $table, $field, $where)
 {
     $qb = $filterBuilder->getQueryBuilder();
     $getValue = function () use($filterBuilder, $value) {
         return $filterBuilder->placeValue($value);
     };
     call_user_func($this->closure, $qb, $table, $field, $getValue);
 }
 public function expand(FilterBuilder $filterBuilder, $value, $table, $field, $where)
 {
     $qb = $filterBuilder->getQueryBuilder();
     // We assume that the discriminator map name was given and no the FQCN
     if (!class_exists($value)) {
         $value = $filterBuilder->placeValue($value);
     }
     return $this->add($qb, $where, new Comparison($table, 'INSTANCE OF', $value));
 }
 public function expand(FilterBuilder $filterBuilder, $value, $table, $field, $where)
 {
     $qb = $filterBuilder->getQueryBuilder();
     $tableField = $table . '.' . $field;
     if (!$this->options['case_sensitive']) {
         $tableField = $qb->expr()->lower($tableField);
         $value = strtolower($value);
     }
     // Doctrine 2.3 can not handle boolean values
     if (is_bool($value)) {
         $value = $value ? 1 : 0;
     }
     return $this->add($qb, $where, $qb->expr()->eq($tableField, $filterBuilder->placeValue($value)));
 }
 public function expand(FilterBuilder $filterBuilder, $value, $table, $field, $where)
 {
     $qb = $filterBuilder->getQueryBuilder();
     $likeString = $this->getLikeString($value);
     return $this->add($qb, $where, $qb->expr()->like($table . '.' . $field, $filterBuilder->placeValue($likeString)));
 }
 /**
  * Where in filter where all values have to match
  *
  * @param FilterBuilder $filterBuilder
  * @param $value
  * @param $table
  * @param $field
  * @param $where
  * @return \Doctrine\ORM\QueryBuilder
  */
 private function buildQueryToMatchAll(FilterBuilder $filterBuilder, $value, $table, $field, $where)
 {
     $qb = $filterBuilder->getQueryBuilder();
     $count = count(array_unique($value));
     return $this->add($qb, $where, $qb->expr()->in($table . '.' . $field, $filterBuilder->placeValue($value)))->groupBy($qb->getRootAliases()[0])->andHaving($qb->expr()->eq($qb->expr()->countDistinct($table), $count));
 }