1
0
mirror of synced 2025-01-18 14:31:40 +03:00

[DDC-3018] Fix string literals in new operator.

This commit is contained in:
Benjamin Eberlei 2014-03-23 15:16:09 +01:00
parent 24d4fd17f3
commit 2aea3036b6
2 changed files with 18 additions and 6 deletions

View File

@ -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;

View File

@ -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)
{
}
}