コード例 #1
0
 public function textFieldCallback(QueryInterface $filterQuery, $field, $values)
 {
     if (!empty($values['value'])) {
         $qb = $filterQuery->getQueryBuilder();
         $qb->andWhere("LOWER({$field}) LIKE LOWER('%{$values['value']}%')");
     }
 }
コード例 #2
0
 public function fieldNameCallback(QueryInterface $filterQuery, $field, $values)
 {
     if (!empty($values['value'])) {
         return $filterQuery->createCondition($filterQuery->getExpr()->neq($field, sprintf('\'%s\'', $values['value'])));
     }
     return null;
 }
コード例 #3
0
 /**
  * {@inheritdoc}
  */
 public function addOnce($join, $alias, \Closure $callback)
 {
     if (isset($this->parts[$join])) {
         return null;
     }
     $this->parts[$join] = $alias;
     return $callback($this->filterQuery->getQueryBuilder(), $this->alias, $alias, $this->filterQuery->getExpr());
 }
コード例 #4
0
 public function enterpriseFieldCallback(QueryInterface $filterQuery, $field, $values)
 {
     if (!empty($values['value'])) {
         $qb = $filterQuery->getQueryBuilder();
         $qb->innerJoin('e.enterprise', 'ee');
         $qb->andWhere("LOWER(ee.name) LIKE LOWER('%{$values['value']}%')");
         $qb->orderBy('ee.id', 'ASC');
     }
 }
コード例 #5
0
 /**
  * {@inheritdoc}
  */
 public function addOnce($join, $alias, \Closure $callback = null)
 {
     if ($this->parts->has($join)) {
         return null;
     }
     $this->parts->add($join, $alias);
     if (!$callback instanceof \Closure) {
         return;
     }
     return $callback($this->filterQuery->getQueryBuilder(), $this->alias, $alias, $this->filterQuery->getExpr());
 }
コード例 #6
0
 public function fioVariantsFieldCallback(QueryInterface $filterQuery, $field, $values)
 {
     if (!empty($values['value'])) {
         $aValues = explode(' ', $values['value']);
         $query = '';
         foreach ($aValues as $key => $val) {
             $val = str_replace("'", '', $val);
             if ($key == 0) {
                 $query .= "LOWER(e.firstname) LIKE LOWER('%{$val}%') OR LOWER(e.lastname) LIKE LOWER('%{$val}%') OR LOWER(e.middlename) LIKE LOWER('%{$val}%')";
             } else {
                 $query .= " OR LOWER(e.firstname) LIKE LOWER('%{$val}%') OR LOWER(e.lastname) LIKE LOWER('%{$val}%') OR LOWER(e.middlename) LIKE LOWER('%{$val}%')";
             }
         }
         $qb = $filterQuery->getQueryBuilder();
         $qb->andWhere($query);
     }
 }
コード例 #7
0
 public function fieldNameCallback(QueryInterface $filterQuery, $field, $values)
 {
     if (!empty($values['value'])) {
         $filterQuery->getQueryBuilder()->andWhere($filterQuery->getExpr()->neq($field, sprintf('\'%s\'', $values['value'])));
     }
 }
コード例 #8
0
 /**
  * @return object
  */
 public function getQueryBuilder()
 {
     return $this->filterQuery->getQueryBuilder();
 }