Skip to content

Commit

Permalink
Merge branch 'master' into remove_duplicate_original_data
Browse files Browse the repository at this point in the history
Conflicts:
	lib/Doctrine/ODM/PHPCR/UnitOfWork.php
  • Loading branch information
lsmith77 committed Mar 12, 2012
2 parents bc42a8f + 07a4d54 commit 84c8742
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 5 additions & 8 deletions lib/Doctrine/ODM/PHPCR/UnitOfWork.php
Expand Up @@ -529,7 +529,7 @@ private function cascadeScheduleInsert($class, $document, &$visited)
}
}

$id = $class->getIdentifierValue($document);
$id = $this->getDocumentId($document);
foreach ($class->childMappings as $childName => $mapping) {
$child = $class->reflFields[$childName]->getValue($document);
if ($child !== null && $this->getDocumentState($child) === self::STATE_NEW) {
Expand Down Expand Up @@ -1377,8 +1377,7 @@ private function executeMoves($documents)

list($document, $targetPath) = $value;

$class = $this->dm->getClassMetadata(get_class($document));
$path = $class->getIdentifierValue($document);
$path = $this->getDocumentId($document);
if ($path === $targetPath) {
continue;
}
Expand Down Expand Up @@ -1744,7 +1743,7 @@ public function getDocumentId($document)
if (empty($this->documentIds[$oid])) {
$msg = 'Document is not managed and has no id';
if (is_object($document)) {
$msg.= ': '.self::objToStr($document, $this->dm);
$msg.= ': '.self::objToStr($document);
}
throw new PHPCRException($msg);
}
Expand Down Expand Up @@ -1983,10 +1982,8 @@ private static function objToStr($obj, DocumentManager $dm = null)

if ($dm) {
try {
$metadata = $dm->getClassMetadata(get_class($obj));
if ($metadata->getIdentifierValue($obj)) {
$string .= ' ('.$metadata->getIdentifierValue($obj).')';
}
$id = $dm->getUnitOfWork()->getDocumentId($obj);
$string .= " ($id)";
} catch (\Exception $e) {
}
}
Expand Down
2 changes: 2 additions & 0 deletions tests/Doctrine/Tests/ODM/PHPCR/UnitOfWorkTest.php
Expand Up @@ -115,6 +115,8 @@ public function testScheduleInsertCancelsScheduleRemove()
$object->username = "bar";
$object->id = '/somepath';

$this->uow->scheduleInsert($object);

$this->uow->scheduleRemove($object);

$method = new \ReflectionMethod($this->uow, 'getDocumentState');
Expand Down

0 comments on commit 84c8742

Please sign in to comment.