/** * Maps a single record into the object it represents and registers it as * reconstituted with the session. * * @param array $objectData * @return object * @author Karsten Dambekalns <*****@*****.**> */ public function mapToObject(array $objectData) { if ($this->persistenceSession->hasIdentifier($objectData['identifier'])) { return $this->persistenceSession->getObjectByIdentifier($objectData['identifier']); } else { $className = $objectData['classname']; $classSchema = $this->reflectionService->getClassSchema($className); $objectConfiguration = $this->objectManager->getObjectConfiguration($className); $object = $this->objectBuilder->createEmptyObject($className, $objectConfiguration); $this->persistenceSession->registerObject($object, $objectData['identifier']); $this->objectBuilder->reinjectDependencies($object, $objectConfiguration); $this->thawProperties($object, $objectData['identifier'], $objectData, $classSchema); $object->FLOW3_Persistence_memorizeCleanState(); $this->persistenceSession->registerReconstitutedObject($object); return $object; } }
/** * @test * @author Robert Lemke <*****@*****.**> */ public function createEmptyObjectPreventsThatTheConstructorOfTheTargetObjectIsCalled() { $objectConfiguration = new \F3\FLOW3\Object\Configuration\Configuration('F3\\FLOW3\\Tests\\Object\\Fixture\\ReconstitutableClassWithSimpleProperties'); $object = $this->objectBuilder->createEmptyObject('F3\\FLOW3\\Tests\\Object\\Fixture\\ReconstitutableClassWithSimpleProperties', $objectConfiguration); $this->assertFalse($object->constructorHasBeenCalled); }