protected function reconstituteObject($objectHash, array $objectData)
{
if (isset($this->reconstitutedObjects[$objectHash])) {
return $this->reconstitutedObjects[$objectHash];
}
$className = $this->objectManager->getClassNameByObjectName($objectData[self::CLASSNAME]);
$object = unserialize('O:' . strlen($className) . ':"' . $className . '":0:{};');
$this->reconstitutedObjects[$objectHash] = $object;
foreach ($objectData[self::PROPERTIES] as $propertyName => $propertyData) {
switch ($propertyData[self::TYPE]) {
case 'simple':
$propertyValue = $propertyData[self::VALUE];
break;
case 'array':
$propertyValue = $this->reconstituteArray($propertyData[self::VALUE]);
break;
case 'Collection':
$propertyValue = $this->reconstituteCollection($propertyData[self::CLASSNAME], $propertyData[self::VALUE]);
break;
case 'ArrayObject':
$propertyValue = new \ArrayObject($this->reconstituteArray($propertyData[self::VALUE]));
break;
case 'object':
$propertyValue = $this->reconstituteObject($propertyData[self::VALUE], $this->objectsAsArray[$propertyData[self::VALUE]]);
break;
case 'SplObjectStorage':
$propertyValue = $this->reconstituteSplObjectStorage($propertyData[self::VALUE]);
break;
case 'persistenceObject':
list($propertyClassName, $propertyUuid) = explode(':', $propertyData[self::VALUE]);
$propertyValue = $this->reconstitutePersistenceObject($propertyClassName, $propertyUuid);
break;
}
$reflectionProperty = new \ReflectionProperty(get_class($object), $propertyName);
$reflectionProperty->setAccessible(true);
$reflectionProperty->setValue($object, $propertyValue);
}
return $object;
}