public function getFromObjectMap() { $className = get_class($this); $cacheKey = kCurrentContext::$ks_hash . '_' . $className; if (isset(self::$fromObjectMap[$cacheKey])) { return self::$fromObjectMap[$cacheKey]; } $reflector = KalturaTypeReflectorCacher::get($className); if (!$reflector) { return array(); } $properties = $reflector->getProperties(); if ($reflector->requiresReadPermission() && !kPermissionManager::getReadPermitted($className, kApiParameterPermissionItem::ALL_VALUES_IDENTIFIER)) { return array(); // current user has no permission for accessing this object class } $result = array(); foreach ($this->getMapBetweenObjects() as $this_prop => $object_prop) { if (is_numeric($this_prop)) { $this_prop = $object_prop; } if (!isset($properties[$this_prop]) || $properties[$this_prop]->isWriteOnly()) { continue; } // ignore property if it requires a read permission which the current user does not have if ($properties[$this_prop]->requiresReadPermission() && !kPermissionManager::getReadPermitted($this->getDeclaringClassName($this_prop), $this_prop)) { KalturaLog::debug("Missing read permission for property {$this_prop}"); continue; } $getter_name = "get{$object_prop}"; $getter_params = array(); if (in_array($this_prop, array("createdAt", "updatedAt", "deletedAt"))) { $getter_params = array(null); } $arrayClass = null; if ($properties[$this_prop]->isArray()) { $class = $properties[$this_prop]->getType(); if (method_exists($class, 'fromDbArray')) { $arrayClass = $class; } } $enumMap = null; if ($properties[$this_prop]->isDynamicEnum()) { $propertyType = $properties[$this_prop]->getType(); $enumClass = call_user_func(array($propertyType, 'getEnumClass')); if ($enumClass) { $enumMap = kPluginableEnumsManager::getCoreMap($enumClass); } } $result[] = array($this_prop, $getter_name, $getter_params, $arrayClass, $enumMap); } self::$fromObjectMap[$cacheKey] = $result; return $result; }
public static function isSearchProviderSource($source) { $refClass = new ReflectionClass('EntrySourceType'); $coreConstants = $refClass->getConstants(); if (in_array($source, array_values($coreConstants))) { return false; } $typeMap = kPluginableEnumsManager::getCoreMap('EntrySourceType'); if (isset($typeMap[$source])) { return false; } return true; }
/** * @param entry $entry * @return array */ private static function getCuePointTypeToClone($entry) { $listOfEnumIds = array(); $cue_point_plugin_map = kPluginableEnumsManager::getCoreMap('CuePointType'); foreach ($cue_point_plugin_map as $dynamic_enum_id => $plugin_name) { $plugin = kPluginableEnumsManager::getPlugin($plugin_name); if ($plugin::shouldCloneByProperty($entry) == true) { $listOfEnumIds[] = $dynamic_enum_id; } } return $listOfEnumIds; }