ILIAS  release_8 Revision v8.24
CachedActiveRecord Class Reference

Class CachedActiveRecord. More...

+ Inheritance diagram for CachedActiveRecord:
+ Collaboration diagram for CachedActiveRecord:

Public Member Functions

 getCache ()
 
 getCacheIdentifier ()
 
 getTTL ()
 
 __construct ($primary_key=0, arConnector $connector=null)
 @inheritDoc More...
 
 afterObjectLoad ()
 
 create ()
 
 copy (int $new_id=0)
 @inheritDoc More...
 
 read ()
 
 update ()
 
 delete ()
 
- Public Member Functions inherited from ActiveRecord
 getArConnector ()
 
 getArFieldList ()
 
 getConnectorContainerName ()
 @description Return the Name of your Connector Table More...
 
 setConnectorContainerName (string $connector_container_name)
 
 getPrimaryFieldValue ()
 
 setPrimaryFieldValue ($value)
 
 __construct ($primary_key=0)
 
 storeObjectToCache ()
 
 asStdClass ()
 
 buildFromArray (array $array)
 
 fixDateField ($field_name, $value)
 
 sleep ($field_name)
 
 wakeUp ($field_name, $field_value)
 
 getArrayForConnector ()
 
 installConnector ()
 
 store ()
 
 save ()
 
 create ()
 
 copy (int $new_id=0)
 
 afterObjectLoad ()
 
 read ()
 
 update ()
 
 delete ()
 
 __call ($name, $arguments)
 

Private Member Functions

 buildHash ()
 

Private Attributes

string $_hash = ''
 

Additional Inherited Members

- Static Public Member Functions inherited from ActiveRecord
static returnDbTableName ()
 
static installDB ()
 
static renameDBField (string $old_name, string $new_name)
 
static tableExists ()
 
static fieldExists (string $field_name)
 
static removeDBField (string $field_name)
 
static updateDB ()
 
static resetDB ()
 
static truncateDB ()
 
static flushDB ()
 @depracated never use in ILIAS Core, Plugins only More...
 
static preloadObjects ()
 
static additionalParams (array $additional_params)
 
static findOrFail ($primary_key, array $add_constructor_args=array())
 Tries to find the object and throws an Exception if object is not found, instead of returning null. More...
 
static findOrGetInstance ($primary_key, array $add_constructor_args=array())
 
static where ($where, $operator=null)
 
static innerjoinAR (ActiveRecord $ar, $on_this, $on_external, array $fields=array(' *'), string $operator='=', $both_external=false)
 
static innerjoin ( $tablename, $on_this, $on_external, array $fields=array(' *'), string $operator='=', bool $both_external=false)
 
static leftjoin ( $tablename, $on_this, $on_external, array $fields=array(' *'), string $operator='=', bool $both_external=false)
 
static orderBy ($orderBy, string $orderDirection='ASC')
 
static dateFormat (string $date_format='d.m.Y - H:i:s')
 
static limit ($start, $end)
 
static affectedRows ()
 
static count ()
 
static get ()
 
static debug ()
 
static first ()
 
static getCollection ()
 
static last ()
 
static getFirstFromLastQuery ()
 
static connector (arConnector $connector)
 
static raw (bool $set_raw=true)
 
static getArray (?string $key=null, $values=null)
 
static _toCamelCase (string $str, bool $capitalise_first_char=false)
 
- Protected Member Functions inherited from ActiveRecord
 installDatabase ()
 
- Static Protected Member Functions inherited from ActiveRecord
static getCalledClass ()
 @description Returns an instance of the instatiated calling active record (needs to be done in static methods) @TODO : This should be cached somehow More...
 
static fromCamelCase (string $str)
 
- Protected Attributes inherited from ActiveRecord
bool $ar_safe_read = true
 
string $connector_container_name = ''
 
bool $is_new = true
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

CachedActiveRecord::__construct (   $primary_key = 0,
arConnector  $connector = null 
)

@inheritDoc

Definition at line 43 of file class.CachedActiveRecord.php.

44 {
45 if (is_null($connector)) {
46 $connector = new arConnectorDB();
47 }
48
49 $connector = new arConnectorCache($connector);
50 arConnectorMap::register($this, $connector);
51 parent::__construct($primary_key);
52 }
Class ilGSStorageCache.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static register(ActiveRecord $ar, arConnector $connector)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct(), and arConnectorMap\register().

+ Here is the call graph for this function:

Member Function Documentation

◆ afterObjectLoad()

CachedActiveRecord::afterObjectLoad ( )

Reimplemented from ActiveRecord.

Definition at line 54 of file class.CachedActiveRecord.php.

54 : void
55 {
56 parent::afterObjectLoad();
57 $this->_hash = $this->buildHash();
58 }

References buildHash().

+ Here is the call graph for this function:

◆ buildHash()

CachedActiveRecord::buildHash ( )
private

Definition at line 60 of file class.CachedActiveRecord.php.

60 : string
61 {
62 $hashing = [];
63 foreach ($this->getArFieldList()->getFields() as $field) {
64 $name = $field->getName();
65 $hashing[$name] = $this->{$name};
66 }
67 return md5(serialize($hashing));
68 }
if($format !==null) $name
Definition: metadata.php:247

References $name, and ActiveRecord\getArFieldList().

Referenced by afterObjectLoad(), read(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copy()

CachedActiveRecord::copy ( int  $new_id = 0)

@inheritDoc

Reimplemented from ActiveRecord.

Definition at line 79 of file class.CachedActiveRecord.php.

80 {
81 $this->getCache()->flush();
82 return parent::copy($new_id);
83 }
Class ActiveRecord.

References getCache().

+ Here is the call graph for this function:

◆ create()

CachedActiveRecord::create ( )

Reimplemented from ActiveRecord.

Reimplemented in ilMMItemStorage.

Definition at line 70 of file class.CachedActiveRecord.php.

70 : void
71 {
72 $this->getCache()->flush();
73 parent::create();
74 }

References getCache().

+ Here is the call graph for this function:

◆ delete()

CachedActiveRecord::delete ( )

Reimplemented from ActiveRecord.

Definition at line 99 of file class.CachedActiveRecord.php.

100 {
101 $this->getCache()->flush();
102 parent::delete(); // TODO: Change the autogenerated stub
103 }

References getCache().

+ Here is the call graph for this function:

◆ getCache()

CachedActiveRecord::getCache ( )
abstract

Reimplemented in ilMMCustomItemStorage, ilMMItemStorage, ilMMItemTranslationStorage, and ilMMTypeActionStorage.

Referenced by copy(), create(), delete(), and update().

+ Here is the caller graph for this function:

◆ getCacheIdentifier()

CachedActiveRecord::getCacheIdentifier ( )
final

Definition at line 26 of file class.CachedActiveRecord.php.

26 : string
27 {
28 if ($this->getArFieldList()->getPrimaryField()) {
29 return ($this->getConnectorContainerName() . "_" . $this->getPrimaryFieldValue());
30 }
31
32 return "";
33 }
getConnectorContainerName()
@description Return the Name of your Connector Table

References ActiveRecord\getArFieldList(), ActiveRecord\getConnectorContainerName(), and ActiveRecord\getPrimaryFieldValue().

+ Here is the call graph for this function:

◆ getTTL()

CachedActiveRecord::getTTL ( )

Definition at line 35 of file class.CachedActiveRecord.php.

35 : int
36 {
37 return 60;
38 }

◆ read()

CachedActiveRecord::read ( )
Exceptions
arException

Reimplemented from ActiveRecord.

Definition at line 85 of file class.CachedActiveRecord.php.

85 : void
86 {
87 parent::read();
88 $this->_hash = $this->buildHash();
89 }

References buildHash().

+ Here is the call graph for this function:

◆ update()

CachedActiveRecord::update ( )

Reimplemented from ActiveRecord.

Definition at line 91 of file class.CachedActiveRecord.php.

92 {
93 if ($this->buildHash() !== $this->_hash) {
94 $this->getCache()->flush();
95 parent::update();
96 }
97 }

References buildHash(), and getCache().

Referenced by ilMMItemStorage\create().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $_hash

string CachedActiveRecord::$_hash = ''
private

Definition at line 22 of file class.CachedActiveRecord.php.


The documentation for this class was generated from the following file: