ILIAS  release_8 Revision v8.24
class.arFieldCache.php
Go to the documentation of this file.
1<?php
2
3/******************************************************************************
4 *
5 * This file is part of ILIAS, a powerful learning management system.
6 *
7 * ILIAS is licensed with the GPL-3.0, you should have received a copy
8 * of said license along with the source code.
9 *
10 * If this is not the case or you just want to try ILIAS, you'll find
11 * us at:
12 * https://www.ilias.de
13 * https://github.com/ILIAS-eLearning
14 *
15 *****************************************************************************/
22{
23 protected static array $cache = array();
24
25 public static function isCached(ActiveRecord $ar): bool
26 {
27 return array_key_exists(get_class($ar), self::$cache);
28 }
29
30 public static function store(ActiveRecord $ar): void
31 {
32 self::$cache[get_class($ar)] = arFieldList::getInstance($ar);
33 }
34
35 public static function storeFromStorage(string $storage_class_name, ActiveRecord $foreign_model): void
36 {
37 self::$cache[$storage_class_name] = arFieldList::getInstanceFromStorage($foreign_model);
38 }
39
40 public static function get(ActiveRecord $ar): \arFieldList
41 {
42 if (!self::isCached($ar)) {
43 self::store($ar);
44 }
45
46 return self::$cache[get_class($ar)];
47 }
48
49 public static function purge(ActiveRecord $ar): void
50 {
51 unset(self::$cache[get_class($ar)]);
52 }
53
54 public static function getPrimaryFieldName(ActiveRecord $ar): string
55 {
56 return self::get($ar)->getPrimaryFieldName();
57 }
58
62 public static function getPrimaryFieldType(ActiveRecord $ar): string
63 {
64 return self::get($ar)->getPrimaryFieldType();
65 }
66}
Class ActiveRecord.
Class arFieldCache.
static getPrimaryFieldName(ActiveRecord $ar)
static storeFromStorage(string $storage_class_name, ActiveRecord $foreign_model)
static get(ActiveRecord $ar)
static isCached(ActiveRecord $ar)
static store(ActiveRecord $ar)
static array $cache
static purge(ActiveRecord $ar)
static getPrimaryFieldType(ActiveRecord $ar)
Class arFieldList.
static getInstanceFromStorage(\ActiveRecord $ar)
static getInstance(ActiveRecord $ar)