Skip to content

Commit

Permalink
Merge branch 'DDC-619'
Browse files Browse the repository at this point in the history
  • Loading branch information
Guilherme Blanco committed Jul 23, 2010
2 parents 7a5ab94 + d50b3c4 commit 5f109c5
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 174 deletions.
7 changes: 3 additions & 4 deletions lib/Doctrine/ORM/Query/AST/Functions/SizeFunction.php
Expand Up @@ -46,10 +46,9 @@ class SizeFunction extends FunctionNode
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{
$dqlAlias = $this->collectionPathExpression->identificationVariable;
$parts = $this->collectionPathExpression->parts;
$assocField = array_pop($parts);

$qComp = $sqlWalker->getQueryComponent(implode('.', array_merge((array) $dqlAlias, $parts)));
$assocField = $this->collectionPathExpression->field;

$qComp = $sqlWalker->getQueryComponent($dqlAlias);
$assoc = $qComp['metadata']->associationMappings[$assocField];
$sql = '';

Expand Down
11 changes: 5 additions & 6 deletions lib/Doctrine/ORM/Query/AST/PathExpression.php
Expand Up @@ -23,11 +23,10 @@
* AssociationPathExpression ::= CollectionValuedPathExpression | SingleValuedAssociationPathExpression
* SingleValuedPathExpression ::= StateFieldPathExpression | SingleValuedAssociationPathExpression
* StateFieldPathExpression ::= SimpleStateFieldPathExpression | SimpleStateFieldAssociationPathExpression
* SingleValuedAssociationPathExpression ::= IdentificationVariable "." {SingleValuedAssociationField "."}* SingleValuedAssociationField
* CollectionValuedPathExpression ::= IdentificationVariable "." {SingleValuedAssociationField "."}* CollectionValuedAssociationField
* SingleValuedAssociationPathExpression ::= IdentificationVariable "." SingleValuedAssociationField
* CollectionValuedPathExpression ::= IdentificationVariable "." CollectionValuedAssociationField
* StateField ::= {EmbeddedClassStateField "."}* SimpleStateField
* SimpleStateFieldPathExpression ::= IdentificationVariable "." StateField
* SimpleStateFieldAssociationPathExpression ::= SingleValuedAssociationPathExpression "." StateField
*
* @since 2.0
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
Expand All @@ -43,13 +42,13 @@ class PathExpression extends Node
public $type;
public $expectedType;
public $identificationVariable;
public $parts;
public $field;

public function __construct($expectedType, $identificationVariable, array $parts)
public function __construct($expectedType, $identificationVariable, $field = null)
{
$this->expectedType = $expectedType;
$this->identificationVariable = $identificationVariable;
$this->parts = $parts;
$this->field = $field;
}

public function dispatch($walker)
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Query/Exec/MultiTableUpdateExecutor.php
Expand Up @@ -84,7 +84,7 @@ public function __construct(AST\Node $AST, $sqlWalker)
$updateSql = 'UPDATE ' . $class->getQuotedTableName($platform) . ' SET ';

foreach ($updateItems as $updateItem) {
$field = $updateItem->pathExpression->parts[0];
$field = $updateItem->pathExpression->field;
if (isset($class->fieldMappings[$field]) && ! isset($class->fieldMappings[$field]['inherited']) ||
isset($class->associationMappings[$field]) && ! $class->associationMappings[$field]->inherited) {
$newValue = $updateItem->newValue;
Expand Down

0 comments on commit 5f109c5

Please sign in to comment.