public function textFieldCallback(QueryInterface $filterQuery, $field, $values) { if (!empty($values['value'])) { $qb = $filterQuery->getQueryBuilder(); $qb->andWhere("LOWER({$field}) LIKE LOWER('%{$values['value']}%')"); } }
public function fieldNameCallback(QueryInterface $filterQuery, $field, $values) { if (!empty($values['value'])) { return $filterQuery->createCondition($filterQuery->getExpr()->neq($field, sprintf('\'%s\'', $values['value']))); } return null; }
/** * {@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()); }
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'); } }
/** * {@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()); }
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); } }
public function fieldNameCallback(QueryInterface $filterQuery, $field, $values) { if (!empty($values['value'])) { $filterQuery->getQueryBuilder()->andWhere($filterQuery->getExpr()->neq($field, sprintf('\'%s\'', $values['value']))); } }
/** * @return object */ public function getQueryBuilder() { return $this->filterQuery->getQueryBuilder(); }