public function canAccessObject($obj) { $serviceId = ""; if (is_string($obj)) { $serviceId = ServiceRegistry::getMapping($obj); } else { $serviceId = TypeLoader::getFullClassName(new ReflectionClass(get_class($obj))); } return $this->canAccess($serviceId); }
public function write(&$obj, IProtocolFormatter $writer) { if ($obj instanceof IRemote) { $this->m_remoteReferenceWriter->write($obj, $writer); return; } if (!$this->m_configured) { $this->m_serializePrivate = false; //ThreadContext.getORBConfig().serializePrivateFields; - skipped $this->m_configured = true; } $className = get_class($obj); $objectFields = array(); $objectClass = null; //Log::log(LoggingConstants::INFO, "****************************************************************"); //Log::log(LoggingConstants::INFO, "serializingclass - ".$className); if (!isset($this->m_cache[$className])) { $objectCache = new ObjectWriterCache(); $objectClass = new ReflectionClass($className); $fullClassName = TypeLoader::getFullClassName($objectClass); $clientSideMapping = $this->getClientClass($className); if (!is_null($clientSideMapping)) { $objectCache->className = $clientSideMapping; } else { $objectCache->className = $fullClassName; } $objectCache->classMeta = $objectClass; $this->m_cache[$className] = $objectCache; $className = $objectCache->className; } else { $objectCache = $this->m_cache[$className]; $className = $objectCache->className; $objectClass = $objectCache->classMeta; } // IAutoUpdate check - skipped while ($objectClass) { $properties = $objectClass->getProperties(); $propCount = count($properties); for ($i = 0; $i < $propCount; $i++) { $prop = $properties[$i]; if (!$prop->isPublic()) { continue; } $propName = $prop->getName(); if (!array_key_exists($propName, $objectFields)) { $val = $prop->getValue($obj); //Log::log(LoggingConstants::INFO, "serializing property - ".$propName." value ".print_r($val, true)); $objectFields[$propName] = $val; } } /* $properties = $objectClass->getStaticProperties(); for ($i = 0; $i < count($properties); $i++) { if(!array_key_exists($properties[$i]->getName(),$objectFields)) { $objectFields[$properties[$i]->getName()] = $properties[$i]->getValue($obj); } } */ $objectClass = $objectClass->getParentClass(); } if (LOGGING) { Log::log(LoggingConstants::INFO, "going to serializer"); } $writer->getObjectSerializer()->writeObject($className, $objectFields, $writer); if (LOGGING) { Log::log(LoggingConstants::INFO, "done with serializer"); } }