Added NOT LIKE expression
This commit is contained in:
parent
f5c1b38e2d
commit
7f33143502
@ -22,7 +22,7 @@ namespace Doctrine\ORM\Query;
|
||||
/**
|
||||
* This class is used to generate DQL expressions via a set of PHP static functions
|
||||
*
|
||||
*
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
@ -479,6 +479,18 @@ class Expr
|
||||
return new Expr\Comparison($x, 'LIKE', $y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a NOT LIKE() comparison expression with the given arguments.
|
||||
*
|
||||
* @param string $x Field in string format to be inspected by LIKE() comparison.
|
||||
* @param mixed $y Argument to be used in LIKE() comparison.
|
||||
* @return Expr\Comparison
|
||||
*/
|
||||
public function notLike($x, $y)
|
||||
{
|
||||
return new Expr\Comparison($x, 'NOT LIKE', $y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a CONCAT() function expression with the given arguments.
|
||||
*
|
||||
|
@ -173,6 +173,11 @@ class ExprTest extends \Doctrine\Tests\OrmTestCase
|
||||
$this->assertEquals('a.description LIKE :description', (string) $this->_expr->like('a.description', ':description'));
|
||||
}
|
||||
|
||||
public function testNotLikeExpr()
|
||||
{
|
||||
$this->assertEquals('a.description NOT LIKE :description', (string) $this->_expr->notLike('a.description', ':description'));
|
||||
}
|
||||
|
||||
public function testConcatExpr()
|
||||
{
|
||||
$this->assertEquals('CONCAT(u.first_name, u.last_name)', (string) $this->_expr->concat('u.first_name', 'u.last_name'));
|
||||
|
Loading…
Reference in New Issue
Block a user