Skip to content

Commit

Permalink
Merge branch 'DDC-3018'
Browse files Browse the repository at this point in the history
  • Loading branch information
beberlei committed Mar 23, 2014
2 parents 24d4fd1 + 2aea303 commit dd8075e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
5 changes: 1 addition & 4 deletions lib/Doctrine/ORM/Query/SqlWalker.php
Original file line number Diff line number Diff line change
Expand Up @@ -1514,6 +1514,7 @@ public function walkNewObject($newObjectExpression)
break;
}

$fieldType = 'string';
switch (true) {
case ($e instanceof AST\PathExpression):
$fieldName = $e->field;
Expand All @@ -1534,10 +1535,6 @@ public function walkNewObject($newObjectExpression)
break;
}
break;

default:
$fieldType = 'string';
break;
}

$this->scalarResultAliasMap[$resultAlias] = $columnAlias;
Expand Down
19 changes: 17 additions & 2 deletions tests/Doctrine/Tests/ORM/Query/LanguageRecognitionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -592,20 +592,28 @@ public function testCaseSupportContainingCoalesceExpression()
}

/**
* @gorup DDC-1858
* @group DDC-1858
*/
public function testHavingSupportIsNullExpression()
{
$this->assertValidDQL("SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u HAVING u.username IS NULL");
}

/**
* @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 */
Expand All @@ -625,3 +633,10 @@ class DQLKeywordsModelGroup
/** @Column */
private $from;
}

class DummyStruct
{
public function __construct($id, $arg1, $arg2, $arg3)
{
}
}

0 comments on commit dd8075e

Please sign in to comment.