public function testUnserializeUpdateGeneral() { $documentManager = $this->documentManager; $user = new User(); $user->setUsername('superdweebie'); $user->setPassword('secret'); //uses Serialize Ignore annotation $user->defineLocation('here'); $user->setProfile(new Profile('Tim', 'Roediger')); $user->setActive(true); $documentManager->persist($user); $documentManager->flush(); $id = $user->getId(); $documentManager->clear(); /* @var $updated User */ $updated = $this->unserializer->fromArray(['id' => $id, 'location' => 'there', 'active' => false, 'profile' => ['firstname' => 'Tom']], self::USER_CLASS, null, Unserializer::UNSERIALIZE_UPDATE); $this->assertEquals('there', $updated->location()); $this->assertEquals(false, $updated->getActive()); $this->assertEquals(null, $updated->getUsername()); $this->assertEquals('Tom', $updated->getProfile()->getFirstname()); $this->assertEquals(null, $updated->getProfile()->getLastname()); }