/** * Check if value is valid * * @param string $field * @param mixed $values */ protected function checkValue($field, $values) { FieldFilterHelper::checkArray($field, $values, FieldFilterHelper::getCode($field)); foreach ($values as $value) { FieldFilterHelper::checkIdentifier($field, $value, FieldFilterHelper::getCode($field)); } }
/** * Check if value is valid * * @param string $field * @param mixed $values */ protected function checkValue($field, $values) { FieldFilterHelper::checkArray($field, $values, 'family'); foreach ($values as $value) { FieldFilterHelper::checkIdentifier($field, $value, 'family'); } }
/** * {@inheritdoc} */ public function getFilter($code, $operator) { $attribute = $this->attributeRepository->findOneBy(['code' => FieldFilterHelper::getCode($code)]); if (null !== $attribute) { return $this->getAttributeFilter($attribute, $operator); } return $this->getFieldFilter($code, $operator); }
/** * {@inheritdoc} */ public function addFieldFilter($field, $operator, $value, $locale = null, $scope = null, $options = []) { if (!is_bool($value)) { throw InvalidArgumentException::booleanExpected($field, 'filter', 'boolean', gettype($value)); } $field = current($this->qb->getRootAliases()) . '.' . FieldFilterHelper::getCode($field); $condition = $this->prepareCriteriaCondition($field, $operator, $value); $this->qb->andWhere($condition); return $this; }
/** * {@inheritdoc} */ public function addFilter($field, $operator, $value, array $context = []) { $attribute = $this->attributeRepository->findOneByIdentifier(FieldFilterHelper::getCode($field)); if (null !== $attribute) { $filter = $this->filterRegistry->getAttributeFilter($attribute, $operator); } else { $filter = $this->filterRegistry->getFieldFilter($field, $operator); } if (null === $filter) { throw new \LogicException(sprintf('Filter on property "%s" is not supported or does not support operator "%s"', $field, $operator)); } $context = $this->getFinalContext($context); if (null !== $attribute) { $context['field'] = $field; $this->addAttributeFilter($filter, $attribute, $operator, $value, $context); } else { $this->addFieldFilter($filter, $field, $operator, $value, $context); } $this->rawFilters[] = ['field' => $field, 'operator' => $operator, 'value' => $value, 'context' => $context]; return $this; }