diff --git a/lib/Doctrine/ORM/Query/SqlWalker.php b/lib/Doctrine/ORM/Query/SqlWalker.php index 33e819bcf..5fd094915 100644 --- a/lib/Doctrine/ORM/Query/SqlWalker.php +++ b/lib/Doctrine/ORM/Query/SqlWalker.php @@ -1514,6 +1514,7 @@ class SqlWalker implements TreeWalker break; } + $fieldType = 'string'; switch (true) { case ($e instanceof AST\PathExpression): $fieldName = $e->field; @@ -1534,10 +1535,6 @@ class SqlWalker implements TreeWalker break; } break; - - default: - $fieldType = 'string'; - break; } $this->scalarResultAliasMap[$resultAlias] = $columnAlias; diff --git a/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php b/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php index 97ad6ac8e..2d3d5fa93 100644 --- a/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php +++ b/tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php @@ -592,7 +592,7 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase } /** - * @gorup DDC-1858 + * @group DDC-1858 */ public function testHavingSupportIsNullExpression() { @@ -600,12 +600,20 @@ class LanguageRecognitionTest extends \Doctrine\Tests\OrmTestCase } /** - * @gorup DDC-1858 + * @group DDC-1858 */ public function testHavingSupportLikeExpression() { $this->assertValidDQL("SELECT _u.id, count(_articles) as uuuu FROM Doctrine\Tests\Models\CMS\CmsUser _u LEFT JOIN _u.articles _articles GROUP BY _u HAVING uuuu LIKE '3'"); } + + /** + * @group DDC-3018 + */ + public function testNewLiteralExpression() + { + $this->assertValidDQL("SELECT new " . __NAMESPACE__ . "\\DummyStruct(u.id, 'foo', 1, true) FROM Doctrine\Tests\Models\CMS\CmsUser u"); + } } /** @Entity */ @@ -625,3 +633,10 @@ class DQLKeywordsModelGroup /** @Column */ private $from; } + +class DummyStruct +{ + public function __construct($id, $arg1, $arg2, $arg3) + { + } +}