diff --git a/application/Espo/ORM/DB/Query/Base.php b/application/Espo/ORM/DB/Query/Base.php index 9259e152c8..2afce2c0a7 100644 --- a/application/Espo/ORM/DB/Query/Base.php +++ b/application/Espo/ORM/DB/Query/Base.php @@ -162,6 +162,8 @@ abstract class Base 'NOT', 'IN', 'NOT_IN', + 'IFNULL', + 'NULLIF', 'BINARY', 'UNIX_TIMESTAMP', 'TIMESTAMPDIFF_DAY', @@ -195,6 +197,8 @@ abstract class Base 'MUL', 'DIV', 'MOD', + 'IFNULL', + 'NULLIF', 'TIMESTAMPDIFF_DAY', 'TIMESTAMPDIFF_MONTH', 'TIMESTAMPDIFF_YEAR', diff --git a/tests/unit/Espo/ORM/DB/QueryTest.php b/tests/unit/Espo/ORM/DB/QueryTest.php index b11b202b86..5b7f9e89bb 100644 --- a/tests/unit/Espo/ORM/DB/QueryTest.php +++ b/tests/unit/Espo/ORM/DB/QueryTest.php @@ -764,6 +764,17 @@ class QueryTest extends \PHPUnit\Framework\TestCase $this->assertEquals($expectedSql, $sql); } + public function testFunction18() + { + $sql = $this->query->createSelectQuery('Comment', [ + 'select' => [["IFNULL:(name, '')", 'test']], + 'withDeleted' => true + ]); + $expectedSql = + "SELECT IFNULL(comment.name, '') AS `test` FROM `comment`"; + $this->assertEquals($expectedSql, $sql); + } + public function testFunctionTZ1() { $sql = $this->query->createSelectQuery('Comment', [