1
0
mirror of synced 2025-01-18 22:41:43 +03:00

Adding the ability to alias new object expressions

This commit is contained in:
James Murray 2014-10-28 17:34:57 -04:00
parent 20c6bfd360
commit 85eac7200d

View File

@ -1353,7 +1353,8 @@ class SqlWalker implements TreeWalker
break;
case ($expr instanceof AST\NewObjectExpression):
$sql .= $this->walkNewObject($expr);
$resultAlias = $selectExpression->fieldIdentificationVariable ?: null;
$sql .= $this->walkNewObject($expr,$resultAlias);
break;
default:
@ -1519,10 +1520,10 @@ class SqlWalker implements TreeWalker
*
* @return string The SQL.
*/
public function walkNewObject($newObjectExpression)
public function walkNewObject($newObjectExpression, $newObjectResultAlias=null)
{
$sqlSelectExpressions = array();
$objIndex = $this->newObjectCounter++;
$objIndex = $newObjectResultAlias?:$this->newObjectCounter++;
foreach ($newObjectExpression->args as $argIndex => $e) {
$resultAlias = $this->scalarResultCounter++;