-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add array and json overlaps conditions
- Loading branch information
Showing
9 changed files
with
84 additions
and
28 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 was deleted.
Oops, something went wrong.
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,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yiisoft\Db\QueryBuilder\Condition; | ||
|
||
/** | ||
* Condition that represents `ARRAY OVERLAPS` operator is used to check if a column of array type overlaps another array. | ||
*/ | ||
final class ArrayOverlapsCondition extends AbstractOverlapsCondition | ||
{ | ||
} |
28 changes: 28 additions & 0 deletions
28
src/QueryBuilder/Condition/Builder/AbstractOverlapsConditionBuilder.php
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,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yiisoft\Db\QueryBuilder\Condition\Builder; | ||
|
||
use Yiisoft\Db\Expression\ExpressionBuilderInterface; | ||
use Yiisoft\Db\Expression\ExpressionInterface; | ||
use Yiisoft\Db\QueryBuilder\QueryBuilderInterface; | ||
|
||
/** | ||
* The base class for classes building SQL expressions for array and JSON overlaps conditions. | ||
*/ | ||
abstract class AbstractOverlapsConditionBuilder implements ExpressionBuilderInterface | ||
{ | ||
public function __construct(protected QueryBuilderInterface $queryBuilder) | ||
{ | ||
} | ||
|
||
protected function prepareColumn(ExpressionInterface|string $column): string | ||
{ | ||
if ($column instanceof ExpressionInterface) { | ||
return $this->queryBuilder->buildExpression($column); | ||
} | ||
|
||
return $this->queryBuilder->quoter()->quoteColumnName($column); | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yiisoft\Db\QueryBuilder\Condition; | ||
|
||
/** | ||
* Condition that represents `JSON OVERLAPS` operator and is used to check if a column of json type overlaps an array. | ||
*/ | ||
final class JsonOverlapsCondition extends AbstractOverlapsCondition | ||
{ | ||
} |
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