Adding the ability to alias new object expressions
This commit is contained in:
parent
20c6bfd360
commit
85eac7200d
1 changed files with 4 additions and 3 deletions
|
@ -1353,7 +1353,8 @@ class SqlWalker implements TreeWalker
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ($expr instanceof AST\NewObjectExpression):
|
case ($expr instanceof AST\NewObjectExpression):
|
||||||
$sql .= $this->walkNewObject($expr);
|
$resultAlias = $selectExpression->fieldIdentificationVariable ?: null;
|
||||||
|
$sql .= $this->walkNewObject($expr,$resultAlias);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1519,10 +1520,10 @@ class SqlWalker implements TreeWalker
|
||||||
*
|
*
|
||||||
* @return string The SQL.
|
* @return string The SQL.
|
||||||
*/
|
*/
|
||||||
public function walkNewObject($newObjectExpression)
|
public function walkNewObject($newObjectExpression, $newObjectResultAlias=null)
|
||||||
{
|
{
|
||||||
$sqlSelectExpressions = array();
|
$sqlSelectExpressions = array();
|
||||||
$objIndex = $this->newObjectCounter++;
|
$objIndex = $newObjectResultAlias?:$this->newObjectCounter++;
|
||||||
|
|
||||||
foreach ($newObjectExpression->args as $argIndex => $e) {
|
foreach ($newObjectExpression->args as $argIndex => $e) {
|
||||||
$resultAlias = $this->scalarResultCounter++;
|
$resultAlias = $this->scalarResultCounter++;
|
||||||
|
|
Loading…
Add table
Reference in a new issue