ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.arFieldCache.php
Go to the documentation of this file.
1<?php
2require_once(dirname(__FILE__) . '/../Fields/class.arFieldList.php');
3
12{
13
17 protected static $cache = array();
18
19
25 public static function isCached(ActiveRecord $ar)
26 {
27 return in_array(get_class($ar), array_keys(self::$cache));
28 }
29
30
34 public static function store(ActiveRecord $ar)
35 {
36 self::$cache[get_class($ar)] = arFieldList::getInstance($ar);
37 }
38
39
47 public static function storeFromStorage($storage_class_name, arStorageInterface $foreign_model)
48 {
49 self::$cache[$storage_class_name] = arFieldList::getInstanceFromStorage($foreign_model);
50 }
51
52
58 public static function get(ActiveRecord $ar)
59 {
60 if (!self::isCached($ar)) {
61 self::store($ar);
62 }
63
64 return self::$cache[get_class($ar)];
65 }
66
67
71 public static function purge(ActiveRecord $ar)
72 {
73 unset(self::$cache[get_class($ar)]);
74 }
75
76
82 public static function getPrimaryFieldName(ActiveRecord $ar)
83 {
84 return self::get($ar)->getPrimaryFieldName();
85 }
86
87
93 public static function getPrimaryFieldType(ActiveRecord $ar)
94 {
95 return self::get($ar)->getPrimaryFieldType();
96 }
97}
Class ActiveRecord.
An exception for terminatinating execution or to throw for unit testing.
Class arFieldCache.
static getPrimaryFieldName(ActiveRecord $ar)
static get(ActiveRecord $ar)
static isCached(ActiveRecord $ar)
static store(ActiveRecord $ar)
static purge(ActiveRecord $ar)
static storeFromStorage($storage_class_name, arStorageInterface $foreign_model)
static getPrimaryFieldType(ActiveRecord $ar)
static getInstanceFromStorage($ar)
static getInstance(ActiveRecord $ar)
Class arStorageInterface.