/** * {@inheritdoc} */ protected function doWalkComparison($fieldName, $operator, $placeholder) { switch ($operator) { case Comparison::IN: return $this->expr->in($fieldName, $placeholder); case Comparison::NIN: return $this->expr->notIn($fieldName, $placeholder); case Comparison::EQ: case Comparison::IS: if ($placeholder === null) { return $this->expr->isNull($fieldName); } return $this->expr->eq($fieldName, $placeholder); case Comparison::NEQ: if ($placeholder === null) { return $this->expr->isNotNull($fieldName); } return $this->expr->neq($fieldName, $placeholder); case Comparison::CONTAINS: return $this->expr->like($fieldName, $placeholder); default: $operator = self::convertComparisonOperator($operator); if ($operator) { return $this->expr->comparison($fieldName, $operator, $placeholder); } throw new \RuntimeException("Unknown comparison operator: " . $operator); } }
/** * Creates an IS NOT NULL expression with the given arguments. * * @param string $x The field in string format to be restricted by IS NOT NULL. * * @return string */ public function isNotNull($x) { $x = $this->helper->quoteColumnName($x); return $this->expressionBuilder->isNotNull($x); }
public function testIsNotNull() { $this->assertEquals($this->doctrineExpressionBuilder->isNotNull('`test`'), $this->expressionBuilder->isNotNull('test')); }