Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 3747ed5

Browse files
committed
Fixed issue with parent ID strategy
- Uses getDocuemntId and not ->getIdentifierValue to determine path of document.
1 parent 32773f2 commit 3747ed5

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

AutoRoute/RouteMaker/AutoRouteMaker.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ protected function getAutoRouteForDocument($document)
9797

9898
protected function documentIsPersisted($document)
9999
{
100-
$metadata = $this->dm->getClassMetadata(get_class($document));
101-
$id = $metadata->getIdentifierValue($document);
100+
$id = $this->dm->getUnitOfWork()->getDocumentId($document);
102101
$phpcrSession = $this->dm->getPhpcrSession();
103102
return $phpcrSession->nodeExists($id);
104103
}

Tests/Unit/AutoRoute/RouteMaker/AutoRouteMakerTest.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public function setUp()
4848
protected function setupDocumentPersisted($isPersisted)
4949
{
5050
$this->dm->expects($this->any())
51-
->method('getClassMetadata')
52-
->will($this->returnValue($this->metadata));
51+
->method('getUnitOfWork')
52+
->will($this->returnValue($this->uow));
5353
$this->dm->expects($this->once())
5454
->method('getPhpcrSession')
5555
->will($this->returnValue($this->phpcrSession));
@@ -77,10 +77,6 @@ public function testCreateOrUpdateAutoRouteForExisting()
7777
->method('getContent')
7878
->will($this->returnValue($this->doc));
7979

80-
$this->dm->expects($this->once())
81-
->method('getUnitOfWork')
82-
->will($this->returnValue($this->uow));
83-
8480
$this->autoRouteStack->expects($this->once())
8581
->method('addRoute')
8682
->with($this->autoRoute1);

0 commit comments

Comments
 (0)