/** * {@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 = sprintf('%s.%s', ProductQueryUtility::NORMALIZED_FIELD, $field); $this->applyFilter($field, $operator, $value); return $this; }
/** * {@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; }
function it_throws_an_exception_if_value_is_not_a_boolean() { $this->shouldThrow(InvalidArgumentException::booleanExpected('enabled', 'filter', 'boolean', gettype('not a boolean')))->during('addFieldFilter', ['enabled', '=', 'not a boolean']); }