/** * {@inheritdoc} */ public function addFieldFilter($field, $operator, $value, $locale = null, $scope = null, $options = []) { if (Operators::IS_EMPTY !== $operator) { $this->checkValue($field, $value); if (FieldFilterHelper::getProperty($field) === FieldFilterHelper::CODE_PROPERTY) { $value = $this->objectIdResolver->getIdsFromCodes('family', $value); } } $fieldCode = FieldFilterHelper::getCode($field); switch ($operator) { case Operators::IN_LIST: $expr = new Expr(); $this->qb->addAnd($expr->field($fieldCode)->in($value)); break; case Operators::NOT_IN_LIST: $this->qb->field($fieldCode)->notIn($value); break; case Operators::IS_EMPTY: $exists = new Expr(); $equals = new Expr(); $expr = new Expr(); $exists->field($fieldCode)->exists(false); $equals->field($fieldCode)->equals(null); $expr->addOr($exists)->addOr($equals); $this->qb->addAnd($expr); break; } return $this; }
private function buildQueryForDisjunction(Disjunction $disjunction, Expr $expr, PropertyId $currentProperty = null) { foreach ($disjunction->getDescriptions() as $description) { $expr->addOr($this->buildQueryForDescription($description, new Expr(), $currentProperty)); } return $expr; }
/** * Add an $or clause to the current query. * * You can create a new expression using the {@link Builder::expr()} method. * * @see Expr::addOr() * @see http://docs.mongodb.org/manual/reference/operator/or/ * @param array|Expr $expression * @return self */ public function addOr($expression) { $this->expr->addOr($expression); return $this; }
/** * Add one or more $or clauses to the current query. * * You can create a new expression using the {@link Builder::matchExpr()} * method. * * @see Expr::addOr() * @see http://docs.mongodb.org/manual/reference/operator/or/ * @param array|Expr $expression * @return $this */ public function addOr($expression) { $this->query->addOr(...func_get_args()); return $this; }