/**
  * Reconstitutes an object from a serialized object without calling the constructor.
  *
  * @param array $objectData The object data array
  * @return void
  * @author Andreas Förthner <*****@*****.**>
  */
 protected function reconstituteObject(array $objectData)
 {
     $object = $this->createEmptyObject($objectData['className']);
     foreach ($objectData['properties'] as $propertyName => $propertyData) {
         switch ($propertyData['type']) {
             case 'simple':
                 $propertyValue = $propertyData['value'];
                 break;
             case 'array':
                 $propertyValue = $this->reconstituteArray($propertyData['value']);
                 break;
             case 'ArrayObject':
                 $propertyValue = new \ArrayObject($this->reconstituteArray($propertyData['value']));
                 break;
             case 'object':
                 $propertyValue = $this->reconstituteObject($this->objectsAsArray[$propertyData['value']]);
                 break;
             case 'SplObjectStorage':
                 $propertyValue = $this->reconstituteSplObjectStorage($propertyData['value']);
                 break;
             case 'persistenceObject':
                 $propertyValue = $this->reconstitutePersistenceObject($propertyData['value']['className'], $propertyData['value']['UUID']);
                 break;
         }
         $reflectionProperty = new \ReflectionProperty(get_class($object), $propertyName);
         $reflectionProperty->setAccessible(TRUE);
         $reflectionProperty->setValue($object, $propertyValue);
     }
     $objectName = $this->objectManager->getObjectNameByClassName($objectData['className']);
     $objectConfigruation = $this->objectManager->getObjectConfiguration($objectName);
     $this->objectBuilder->reinjectDependencies($object, $objectConfigruation);
     $this->objectManager->registerShutdownObject($object, $objectConfigruation->getLifecycleShutdownMethodName());
     return $object;
 }
 /**
  * @test
  * @author Karsten Dambekalns <*****@*****.**>
  */
 public function reinjectDependenciesTriesToDependencyInjectPropertiesWhichAreNotPersistable()
 {
     $mockReflectionService = $this->getMock('F3\\FLOW3\\Reflection\\ReflectionService');
     $mockReflectionService->expects($this->any())->method('getPropertyNamesByTag')->will($this->returnValue(array()));
     $objectBuilder = new \F3\FLOW3\Object\ObjectBuilder();
     $objectBuilder->injectObjectManager($this->mockObjectManager);
     $objectBuilder->injectObjectFactory($this->mockObjectFactory);
     $objectBuilder->injectReflectionService($mockReflectionService);
     $objectConfiguration = new \F3\FLOW3\Object\Configuration\Configuration('F3\\FLOW3\\Tests\\Object\\Fixture\\ReconstitutableClassWithSimpleProperties');
     $objectConfiguration->setProperty(new \F3\FLOW3\Object\Configuration\ConfigurationProperty('stringDependency', 'wasInjected'));
     $object = $objectBuilder->createEmptyObject('F3\\FLOW3\\Tests\\Object\\Fixture\\ReconstitutableClassWithSimpleProperties', $objectConfiguration);
     $objectBuilder->reinjectDependencies($object, $objectConfiguration);
     $this->assertEquals('wasInjected', $object->FLOW3_AOP_Proxy_getProperty('stringDependency'));
 }
 /**
  * Initializes the Object framework.
  *
  * @return void
  * @author Robert Lemke <*****@*****.**>
  * @see initialize()
  */
 public function initializeObjectManager()
 {
     $this->objectFactory = new \F3\FLOW3\Object\ObjectFactory();
     $objectBuilder = new \F3\FLOW3\Object\ObjectBuilder();
     $objectBuilder->injectConfigurationManager($this->configurationManager);
     $singletonObjectsRegistry = new \F3\FLOW3\Object\TransientRegistry();
     $preliminaryReflectionService = new \F3\FLOW3\Reflection\ReflectionService();
     $this->objectManager = new \F3\FLOW3\Object\ObjectManager();
     $this->objectManager->injectSingletonObjectsRegistry($singletonObjectsRegistry);
     $this->objectManager->injectObjectBuilder($objectBuilder);
     $this->objectManager->injectObjectFactory($this->objectFactory);
     $this->objectManager->injectReflectionService($preliminaryReflectionService);
     $this->objectManager->injectConfigurationManager($this->configurationManager);
     $this->objectManager->setContext($this->context);
     $this->objectManager->initializeManager();
     // Remove the preliminary reflection service and rebuild it, this time with the proper object configuration:
     $singletonObjectsRegistry->removeObject('F3\\FLOW3\\Reflection\\ReflectionService');
     $this->objectManager->injectReflectionService($this->objectManager->getObject('F3\\FLOW3\\Reflection\\ReflectionService'));
     $singletonObjectsRegistry->putObject('F3\\FLOW3\\Resource\\ClassLoader', $this->classLoader);
     $singletonObjectsRegistry->putObject('F3\\FLOW3\\Configuration\\ConfigurationManager', $this->configurationManager);
     $this->configurationManager->injectEnvironment($this->objectManager->getObject('F3\\FLOW3\\Utility\\Environment'));
 }