Skip to content

Commit

Permalink
Resolve association entries on multi get cache
Browse files Browse the repository at this point in the history
  • Loading branch information
goetas committed Feb 2, 2015
1 parent 8435e1f commit 268426a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Cache/DefaultCollectionHydrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function loadCacheEntry(ClassMetadata $metadata, CollectionCacheKey $key,

/* @var $entityEntries \Doctrine\ORM\Cache\EntityCacheEntry[] */
foreach ($entityEntries as $index => $entityEntry) {
$list[$index] = $this->uow->createEntity($entityEntry->class, $entityEntry->data, self::$hints);
$list[$index] = $this->uow->createEntity($entityEntry->class, $entityEntry->resolveAssociationEntries($this->em), self::$hints);
}

array_walk($list, function($entity, $index) use ($collection) {
Expand Down
4 changes: 0 additions & 4 deletions lib/Doctrine/ORM/UnitOfWork.php
Original file line number Diff line number Diff line change
Expand Up @@ -2625,10 +2625,6 @@ public function createEntity($className, array $data, &$hints = array())

if ($joinColumnValue !== null) {
if ($targetClass->containsForeignIdentifier) {
if ($joinColumnValue instanceof AssociationCacheEntry) {
$joinColumnValue = implode(' ', $joinColumnValue->identifier);
}

$associatedId[$targetClass->getFieldForColumn($targetColumn)] = $joinColumnValue;
} else {
$associatedId[$targetClass->fieldNames[$targetColumn]] = $joinColumnValue;
Expand Down
4 changes: 1 addition & 3 deletions lib/Doctrine/ORM/Utility/IdentifierFlattener.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ public function flattenIdentifier(ClassMetadata $class, array $id)
$flatId = array();

foreach ($class->identifier as $field) {
if (isset($class->associationMappings[$field]) && isset($id[$field]) && $id[$field] instanceof \Doctrine\ORM\Cache\AssociationCacheEntry) {
$flatId[$field] = implode(' ', $id[$field]->identifier);
} elseif (isset($class->associationMappings[$field]) && isset($id[$field]) && is_object($id[$field])) {
if (isset($class->associationMappings[$field]) && isset($id[$field]) && is_object($id[$field])) {
$targetClassMetadata = $this->metadataFactory->getMetadataFor(
$class->associationMappings[$field]['targetEntity']
);
Expand Down

0 comments on commit 268426a

Please sign in to comment.