Skip to content

Commit

Permalink
UPdate
Browse files Browse the repository at this point in the history
  • Loading branch information
bohanyang committed Sep 6, 2023
1 parent 7da6860 commit 6c53759
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions packages/mango/Doctrine/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
use function strpos;

/**
* @method $this where($predicates)
* @method $this andWhere($where)
* @method $this orWhere($where)
* @method $this setMaxResults(int|null $maxResults)
Expand Down Expand Up @@ -897,13 +896,30 @@ public function __call($name, $arguments)
return $returnValue === $this->builder ? $this : $returnValue;
}

public function and(string|CompositeExpression $expression, string|CompositeExpression ...$expressions): CompositeExpression
public function and(string|CompositeExpression ...$expressions): CompositeExpression
{
return CompositeExpression::and($expression, ...$expressions);
return CompositeExpression::and(...$expressions);
}

public function or(string|CompositeExpression $expression, string|CompositeExpression ...$expressions): CompositeExpression
public function or(string|CompositeExpression ...$expressions): CompositeExpression
{
return CompositeExpression::or($expression, ...$expressions);
return CompositeExpression::or(...$expressions);
}

public function where(mixed ...$expressions): self
{
$where = [];
foreach ($expressions as $matchColumn => $expression) {
if (is_string($matchColumn)) {
$where[] = $this->eq($matchColumn, $expression);
continue;
}

$where[] = $expression;
}

$this->builder->andWhere(...$where);

return $this;
}
}

0 comments on commit 6c53759

Please sign in to comment.