Skip to content

Commit

Permalink
drop QueryBuilder parameter for dbal aggregation
Browse files Browse the repository at this point in the history
  • Loading branch information
hrach committed Oct 31, 2024
1 parent 4375d6b commit 67e14dc
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/Collection/Aggregations/Aggregator.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public function aggregateValues(array $values);


public function aggregateExpression(
QueryBuilder $queryBuilder,
DbalExpressionResult $expression,
ExpressionContext $context,
): DbalExpressionResult;
Expand Down
1 change: 0 additions & 1 deletion src/Collection/Aggregations/AnyAggregator.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public function aggregateValues(array $values): bool


public function aggregateExpression(
QueryBuilder $queryBuilder,
DbalExpressionResult $expression,
ExpressionContext $context,
): DbalExpressionResult
Expand Down
1 change: 0 additions & 1 deletion src/Collection/Aggregations/CountAggregator.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public function aggregateValues(array $values): bool


public function aggregateExpression(
QueryBuilder $queryBuilder,
DbalExpressionResult $expression,
ExpressionContext $context,
): DbalExpressionResult
Expand Down
1 change: 0 additions & 1 deletion src/Collection/Aggregations/NoneAggregator.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public function aggregateValues(array $values): bool


public function aggregateExpression(
QueryBuilder $queryBuilder,
DbalExpressionResult $expression,
ExpressionContext $context,
): DbalExpressionResult
Expand Down
1 change: 0 additions & 1 deletion src/Collection/Aggregations/NumericAggregator.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public function aggregateValues(array $values): mixed


public function aggregateExpression(
QueryBuilder $queryBuilder,
DbalExpressionResult $expression,
ExpressionContext $context,
): DbalExpressionResult
Expand Down
2 changes: 1 addition & 1 deletion src/Collection/Functions/BaseNumericAggregateFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ public function processDbalExpression(
}

return $helper->processExpression($builder, $args[0], $context, $this->aggregator)
->applyAggregator($builder, ExpressionContext::ValueExpression);
->applyAggregator(ExpressionContext::ValueExpression);
}
}
5 changes: 2 additions & 3 deletions src/Collection/Functions/Result/DbalExpressionResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


use Nextras\Dbal\Platforms\Data\Fqn;
use Nextras\Dbal\QueryBuilder\QueryBuilder;
use Nextras\Orm\Collection\Aggregations\Aggregator;
use Nextras\Orm\Collection\Expression\ExpressionContext;
use Nextras\Orm\Entity\Reflection\PropertyMetadata;
Expand Down Expand Up @@ -164,8 +163,8 @@ public function withHavingArgs(string $havingExpression, array $havingArgs): Dba
/**
* Applies the aggregator and returns modified expression result.
*/
public function applyAggregator(QueryBuilder $queryBuilder, ExpressionContext $context): DbalExpressionResult
public function applyAggregator(ExpressionContext $context): DbalExpressionResult
{
return $this->aggregator?->aggregateExpression($queryBuilder, $this, $context) ?? $this;
return $this->aggregator?->aggregateExpression($this, $context) ?? $this;
}
}

0 comments on commit 67e14dc

Please sign in to comment.