コード例 #1
0
 protected static function loadApiMap($useCache = true)
 {
     $apiCachePath = kConf::get('cache_root_path') . '/ApiPluginableEnums.cache';
     if ($useCache && file_exists($apiCachePath)) {
         self::$apiMap = unserialize(file_get_contents($apiCachePath));
         return;
     }
     self::$apiMap = array();
     $dynamicEnums = DynamicEnumPeer::doSelect(new Criteria());
     foreach ($dynamicEnums as $dynamicEnum) {
         $dynamicEnumId = $dynamicEnum->getId();
         $dynamicEnumType = $dynamicEnum->getEnumName();
         $dynamicEnumApiName = $dynamicEnum->getPluginName() . IKalturaEnumerator::PLUGIN_VALUE_DELIMITER . $dynamicEnum->getValueName();
         if (!isset(self::$apiMap[$dynamicEnumType])) {
             self::$apiMap[$dynamicEnumType] = array();
         }
         self::$apiMap[$dynamicEnumType][$dynamicEnumApiName] = $dynamicEnumId;
     }
     file_put_contents($apiCachePath, serialize(self::$apiMap));
 }