Permalink
Browse files

Fixing issue with custom id being sent with update everytime.

  • Loading branch information...
1 parent c45ba00 commit ad8a7821bd176e875b9ec1f756c32a15eed31fb3 @jwage jwage committed Aug 7, 2010
Showing with 3 additions and 2 deletions.
  1. +2 −0 lib/Doctrine/ODM/MongoDB/Hydrator.php
  2. +1 −2 lib/Doctrine/ODM/MongoDB/UnitOfWork.php
@@ -104,6 +104,8 @@ public function hydrate($document, &$data)
// Set the document identifier
if (isset($data['_id'])) {
$metadata->setIdentifierValue($document, $data['_id']);
+ $data[$metadata->identifier] = $data['_id'];
+ unset($data['_id']);
}
return $document;
}
@@ -385,8 +385,7 @@ public function computeChangeSet(Mapping\ClassMetadata $class, $document)
$coll->setDirty( ! $coll->isEmpty());
$class->reflFields[$name]->setValue($document, $coll);
$actualData[$name] = $coll;
- }
- if ($class->isCollectionValuedEmbed($name) && $actualData[$name] !== null
+ } elseif ($class->isCollectionValuedEmbed($name) && $actualData[$name] !== null
&& ! ($actualData[$name] instanceof Collection)) {
// If $actualData[$name] is not a Collection then use an ArrayCollection.
if ( ! $actualData[$name] instanceof Collection) {

0 comments on commit ad8a782

Please sign in to comment.