Skip to content

Commit 76a15ca

Browse files
committed
ZfcUserExtension needs to re-attach the entity
Closes #4
1 parent 9468f68 commit 76a15ca

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/LdcUserProfile/Extensions/ZfcUser/ZfcUserExtension.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ public function save($entity)
9090
$userobj = $this->getUserService()->getUserMapper()->findById($entity->zfcuser->getId());
9191
$this->transferChangesToExistingEntity($entity->zfcuser, $userobj);
9292

93+
// Stash the new entity back in the original's place so that later
94+
// extensions can use it in Doctrine associations safely
95+
$entity->zfcuser = $userobj;
96+
9397
return $this->getUserService()->getUserMapper()->update($userobj);
9498
}
9599

tests/LdcUserProfileTest/Extensions/ZfcUser/ZfcUserExtensionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public function testSaveProxiesToUserMapper()
6767
$this->extension->setUserService($mockUserService);
6868

6969
$this->assertEquals('boolean', $this->extension->save($arg));
70+
$this->assertSame($mockUserEntity, $arg->zfcuser);
7071
}
7172

7273
public function testSaveWillHashTheUsersPasswordInZfcUserOneOneZeroAndBelow()

0 commit comments

Comments
 (0)