12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- namespace yii\db\conditions;
- use yii\db\ExpressionBuilderInterface;
- use yii\db\ExpressionBuilderTrait;
- use yii\db\ExpressionInterface;
- class NotConditionBuilder implements ExpressionBuilderInterface
- {
- use ExpressionBuilderTrait;
-
- public function build(ExpressionInterface $expression, array &$params = [])
- {
- $operand = $expression->getCondition();
- if ($operand === '') {
- return '';
- }
- $expession = $this->queryBuilder->buildCondition($operand, $params);
- return "{$this->getNegationOperator()} ($expession)";
- }
-
- protected function getNegationOperator()
- {
- return 'NOT';
- }
- }
|