ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
class.arFieldCache.php
Go to the documentation of this file.
1 <?php
2 require_once(dirname(__FILE__) . '/../Fields/class.arFieldList.php');
3 
11 class arFieldCache {
12 
16  protected static $cache = array();
17 
18 
24  public static function isCached(ActiveRecord $ar) {
25  return in_array(get_class($ar), array_keys(self::$cache));
26  }
27 
28 
32  public static function store(ActiveRecord $ar) {
33  self::$cache[get_class($ar)] = arFieldList::getInstance($ar);
34  }
35 
36 
44  public static function storeFromStorage($storage_class_name, arStorageInterface $foreign_model) {
45  self::$cache[$storage_class_name] = arFieldList::getInstanceFromStorage($foreign_model);
46  }
47 
48 
57  public static function get(ActiveRecord $ar) {
58  if (!self::isCached($ar)) {
59  self::store($ar);
60  }
61 
62  return self::$cache[get_class($ar)];
63  }
64 
65 
69  public static function purge(ActiveRecord $ar) {
70  unset(self::$cache[get_class($ar)]);
71  }
72 
73 
79  public static function getPrimaryFieldName(ActiveRecord $ar) {
80  return self::get($ar)->getPrimaryFieldName();
81  }
82 
83 
89  public static function getPrimaryFieldType(ActiveRecord $ar) {
90  return self::get($ar)->getPrimaryFieldType();
91  }
92 }
93 
94 ?>
Class arFieldCache.
Class arStorageInterface.
static getPrimaryFieldName(ActiveRecord $ar)
static getPrimaryFieldType(ActiveRecord $ar)
static getInstance(ActiveRecord $ar)
Class ActiveRecord.
static store(ActiveRecord $ar)
static getInstanceFromStorage($ar)
static storeFromStorage($storage_class_name, arStorageInterface $foreign_model)
static purge(ActiveRecord $ar)
static isCached(ActiveRecord $ar)