sql generation
This commit is contained in:
parent
ee7b5da64a
commit
0c1a8cd43f
@ -1642,19 +1642,18 @@ class Parser
|
||||
|
||||
$this->match(Lexer::T_OPEN_PARENTHESIS);
|
||||
|
||||
$fieldSet[] = $this->SimpleSelectExpression();
|
||||
$fieldSet[] = $this->SelectExpression();
|
||||
while ($this->_lexer->isNextToken(Lexer::T_COMMA)) {
|
||||
$this->match(Lexer::T_COMMA);
|
||||
|
||||
$fieldSet[] = $this->SimpleSelectExpression();
|
||||
$fieldSet[] = $this->SelectExpression();
|
||||
}
|
||||
|
||||
$this->match(Lexer::T_CLOSE_PARENTHESIS);
|
||||
|
||||
$expression = new AST\NewObjectExpression($identificationVariable, $fieldSet);
|
||||
|
||||
// @TODO : Defer NewObjectExpression validation
|
||||
throw new \BadMethodCallException("Not complete yet !");
|
||||
// @TODO : Defer NewObjectExpression validation ?
|
||||
return $expression;
|
||||
}
|
||||
|
||||
|
@ -1221,6 +1221,12 @@ class SqlWalker implements TreeWalker
|
||||
}
|
||||
break;
|
||||
|
||||
case ($expr instanceof AST\NewObjectExpression):
|
||||
$sqlSelectExpressions = array_filter(array_map(array($this, 'walkSelectExpression'), $expr->fieldSet));
|
||||
$sql .= implode(', ', $sqlSelectExpressions);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
// IdentificationVariable or PartialObjectExpression
|
||||
if ($expr instanceof AST\PartialObjectExpression) {
|
||||
|
@ -1560,7 +1560,6 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
||||
*/
|
||||
public function testSupportsNewOperator()
|
||||
{
|
||||
$this->markTestIncomplete('not complete yet !');
|
||||
$this->assertSqlGeneration(
|
||||
'SELECT new Doctrine\Tests\Models\CMS\CmsUser(u.name, e.email, a.city) FROM Doctrine\Tests\Models\CMS\CmsUser u JOIN u.email e JOIN u.address a',
|
||||
'SELECT c0_.name AS name0, c1_.email AS email1, c2_.city AS city2 FROM cms_users c0_ INNER JOIN cms_emails c1_ ON c0_.email_id = c1_.id INNER JOIN cms_addresses c2_ ON c0_.id = c2_.user_id'
|
||||
|
Loading…
x
Reference in New Issue
Block a user