| @@ 23-52 (lines=30) @@ | ||
| 20 | /** |
|
| 21 | * @deprecated This class is deprecated since version 1.1 and will be removed in 2.0. |
|
| 22 | */ |
|
| 23 | class BitNot implements Operand |
|
| 24 | { |
|
| 25 | /** |
|
| 26 | * @var Operand|string |
|
| 27 | */ |
|
| 28 | private $field; |
|
| 29 | ||
| 30 | /** |
|
| 31 | * @param Operand|string $field |
|
| 32 | */ |
|
| 33 | public function __construct($field) |
|
| 34 | { |
|
| 35 | $this->field = $field; |
|
| 36 | } |
|
| 37 | ||
| 38 | /** |
|
| 39 | * @param QueryBuilder $qb |
|
| 40 | * @param string $dqlAlias |
|
| 41 | * |
|
| 42 | * @return string |
|
| 43 | */ |
|
| 44 | public function transform(QueryBuilder $qb, $dqlAlias) |
|
| 45 | { |
|
| 46 | $field = ArgumentToOperandConverter::toField($this->field); |
|
| 47 | ||
| 48 | $field = $field->transform($qb, $dqlAlias); |
|
| 49 | ||
| 50 | return sprintf('(~ %s)', $field); |
|
| 51 | } |
|
| 52 | } |
|
| 53 | ||
| @@ 18-46 (lines=29) @@ | ||
| 15 | ||
| 16 | use Doctrine\ORM\QueryBuilder; |
|
| 17 | ||
| 18 | class CountDistinct implements Operand |
|
| 19 | { |
|
| 20 | /** |
|
| 21 | * @var Operand|string |
|
| 22 | */ |
|
| 23 | private $field; |
|
| 24 | ||
| 25 | /** |
|
| 26 | * @param Operand|string $field |
|
| 27 | */ |
|
| 28 | public function __construct($field) |
|
| 29 | { |
|
| 30 | $this->field = $field; |
|
| 31 | } |
|
| 32 | ||
| 33 | /** |
|
| 34 | * @param QueryBuilder $qb |
|
| 35 | * @param string $dqlAlias |
|
| 36 | * |
|
| 37 | * @return string |
|
| 38 | */ |
|
| 39 | public function transform(QueryBuilder $qb, $dqlAlias) |
|
| 40 | { |
|
| 41 | $field = ArgumentToOperandConverter::toField($this->field); |
|
| 42 | $field = $field->transform($qb, $dqlAlias); |
|
| 43 | ||
| 44 | return sprintf('COUNT(DISTINCT %s)', $field); |
|
| 45 | } |
|
| 46 | } |
|
| 47 | ||