-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
338 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace Nextras\Orm\Collection\Helpers; | ||
|
||
|
||
use Nextras\Dbal\QueryBuilder\QueryBuilder; | ||
use function array_merge; | ||
use function array_pop; | ||
use function array_shift; | ||
|
||
|
||
class DbalAnyAggregator implements IDbalAggregator | ||
{ | ||
public function aggregate( | ||
QueryBuilder $queryBuilder, | ||
DbalExpressionResult $expression | ||
): DbalExpressionResult | ||
{ | ||
$joinExpression = array_shift($expression->args); | ||
$joinArgs = $expression->args; | ||
$joins = $expression->joins; | ||
$join = array_pop($joins); | ||
|
||
$joins[] = new DbalJoinEntry( | ||
$join->toExpression, | ||
$join->alias, | ||
"($join->onExpression) AND $joinExpression", | ||
array_merge($join->args, $joinArgs), | ||
$join->conventions | ||
); | ||
|
||
$primaryKey = $join->conventions->getStoragePrimaryKey()[0]; | ||
return new DbalExpressionResult( | ||
['COUNT(%table.%column) > 0', $join->alias, $primaryKey], | ||
$joins, | ||
null, | ||
true, | ||
null, | ||
null | ||
); | ||
} | ||
} |
Oops, something went wrong.