/** * {@inheritdoc} */ public function walkComparison(Comparison $comparison) { list($type, $field) = Criteria::explodeFieldTypeName($comparison->getField()); $value = $comparison->getValue()->getValue(); if (is_array($value)) { $value = sprintf('(%s)', implode(', ', $value)); } if ($type === Query::TYPE_TEXT) { $value = sprintf('"%s"', $value); } return sprintf('%s %s %s %s', $type, $field, Criteria::getSearchOperatorByComparisonOperator($comparison->getOperator()), $value); }
/** * {@inheritdoc} */ public function walkComparison(Comparison $comparison) { $value = $comparison->getValue()->getValue(); list($type, $field) = $this->explodeCombinedFieldString($comparison->getField()); $index = str_replace('.', '_', uniqid('', true)); $joinField = sprintf('search.%sFields', $type); $joinAlias = $this->driver->getJoinAlias($type, $index); $this->qb->leftJoin($joinField, $joinAlias); $searchCondition = ['fieldName' => $field, 'condition' => Criteria::getSearchOperatorByComparisonOperator($comparison->getOperator()), 'fieldValue' => $value, 'fieldType' => $type]; if ($type === Query::TYPE_TEXT) { if ($searchCondition['fieldValue'] === '') { $this->qb->setParameter('field' . $index, $searchCondition['fieldName']); return $joinAlias . '.field = :field' . $index; } else { return $this->driver->addTextField($this->qb, $index, $searchCondition, $this->setOrderBy); } } return $this->driver->addNonTextField($this->qb, $index, $searchCondition); }