From e33bd03aa8c5f458c2f8ddd530495c93768a8244 Mon Sep 17 00:00:00 2001 From: zYne Date: Fri, 15 Dec 2006 23:03:37 +0000 Subject: [PATCH] added isNotNull support --- lib/Doctrine/Expression.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/Doctrine/Expression.php b/lib/Doctrine/Expression.php index cc4a5050e..7b41c81c3 100644 --- a/lib/Doctrine/Expression.php +++ b/lib/Doctrine/Expression.php @@ -565,6 +565,24 @@ class Doctrine_Expression extends Doctrine_Connection_Module { $expression = $this->getIdentifier($expression); return $expression . ' IS NULL'; } + /** + * Returns SQL that checks if a expression is not null. + * + * Example: + * + * $q = new Doctrine_Query(); + * $q->select('u.*') + * ->from('User u') + * ->where($q->expr->isNotNull('id')); + * + * + * @param string $expression the expression that should be compared to null + * @return string logical expression + */ + public function isNotNull($expression) { + $expression = $this->getIdentifier($expression); + return $expression . ' IS NOT NULL'; + } /** * Returns SQL that checks if an expression evaluates to a value between * two values.