ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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)
 
 afterObjectLoad ()
 
 storeObjectToCache ()
 
 buildFromArray (array $array)
 
 store ()
 
 save ()
 
 create ()
 
 copy ($new_id=0)
 
 read ()
 
 update ()
 
 delete ()
 
- Public Member Functions inherited from ActiveRecord
 getArConnector ()
 
 getArFieldList ()
 
 getConnectorContainerName ()
 
 setConnectorContainerName ($connector_container_name)
 
 getPrimaryFieldValue ()
 
 setPrimaryFieldValue ($value)
 
 __construct ($primary_key=0, arConnector $connector=null)
 
 storeObjectToCache ()
 
 __getConvertedDateFieldsAsArray ($format=null)
 
 __asCsv ($separator=';', $header=false)
 
 __asArray ()
 
 __asStdClass ()
 
 __asSerializedObject ()
 
 buildFromArray (array $array)
 
 fixDateField ($field_name, $value)
 
 sleep ($field_name)
 
 wakeUp ($field_name, $field_value)
 
 getArrayForDb ()
 
 getArrayForConnector ()
 
 installConnector ()
 
 store ()
 
 save ()
 
 create ()
 
 copy ($new_id=0)
 
 afterObjectLoad ()
 
 read ()
 
 update ()
 
 delete ()
 
 __call ($name, $arguments)
 

Static Public Member Functions

static find ($primary_key, array $add_constructor_args=array())
 
static connector (arConnector $connector)
 
- Static Public Member Functions inherited from ActiveRecord
static returnDbTableName ()
 
static installDB ()
 
static renameDBField ($old_name, $new_name)
 
static tableExists ()
 
static fieldExists ($field_name)
 
static removeDBField ($field_name)
 
static updateDB ()
 
static resetDB ()
 
static truncateDB ()
 
static flushDB ()
 
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, $fields=array(' *'), $operator='=', $both_external=false)
 
static innerjoin ($tablename, $on_this, $on_external, $fields=array(' *'), $operator='=', $both_external=false)
 
static leftjoin ($tablename, $on_this, $on_external, $fields=array(' *'), $operator='=', $both_external=false)
 
static orderBy ($orderBy, $orderDirection='ASC')
 
static dateFormat ($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 ($set_raw=true)
 
static getArray ($key=null, $values=null)
 
static _toCamelCase ($str, $capitalise_first_char=false)
 

Private Member Functions

 buildHash ()
 

Private Attributes

 $_hash = ''
 

Additional Inherited Members

- Data Fields inherited from ActiveRecord
const ACTIVE_RECORD_VERSION = '2.0.7'
 
- Protected Member Functions inherited from ActiveRecord
 serializeToCSV ($field)
 This method is called for every field of your instance if you use __asCsv. More...
 
 installDatabase ()
 
- Static Protected Member Functions inherited from ActiveRecord
static getCalledClass ()
 
static fromCamelCase ($str)
 
- Protected Attributes inherited from ActiveRecord
 $ar_safe_read = true
 
 $connector_container_name = ''
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

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

References arConnectorMap\register().

40  {
41  if (is_null($connector)) {
42  $connector = new arConnectorDB();
43  }
44 
45  $connector = new arConnectorCache($connector);
46  arConnectorMap::register($this, $connector);
47  parent::__construct($primary_key, $connector);
48  }
Class arConnectorDB.
static register(ActiveRecord $ar, arConnector $connector)
Class ilGSStorageCache.
+ Here is the call graph for this function:

Member Function Documentation

◆ afterObjectLoad()

CachedActiveRecord::afterObjectLoad ( )

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

References buildHash().

51  {
52  parent::afterObjectLoad();
53  $this->_hash = $this->buildHash();
54  }
+ Here is the call graph for this function:

◆ buildFromArray()

CachedActiveRecord::buildFromArray ( array  $array)

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

75  {
76  return parent::buildFromArray($array);
77  }

◆ buildHash()

CachedActiveRecord::buildHash ( )
private

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

References $name, and ActiveRecord\getArFieldList().

Referenced by afterObjectLoad(), and update().

56  : string
57  {
58  $hashing = [];
59  foreach ($this->getArFieldList()->getFields() as $field) {
60  $name = $field->getName();
61  $hashing[$name] = $this->{$name};
62  }
63  return md5(serialize($hashing));
64  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ connector()

static CachedActiveRecord::connector ( arConnector  $connector)
static

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

135  {
136  return parent::connector($connector); // TODO: Change the autogenerated stub
137  }

◆ copy()

CachedActiveRecord::copy (   $new_id = 0)

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

References getCache().

99  {
100  $this->getCache()->flush();
101  return parent::copy($new_id);
102  }
+ Here is the call graph for this function:

◆ create()

CachedActiveRecord::create ( )

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

References getCache().

90  {
91  $this->getCache()->flush();
92  parent::create();
93  }
+ Here is the call graph for this function:

◆ delete()

CachedActiveRecord::delete ( )

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

References getCache().

118  {
119  $this->getCache()->flush();
120  parent::delete(); // TODO: Change the autogenerated stub
121  }
+ Here is the call graph for this function:

◆ find()

◆ getCache()

CachedActiveRecord::getCache ( )
abstract
Returns
ilGlobalCache

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

+ Here is the caller graph for this function:

◆ getCacheIdentifier()

CachedActiveRecord::getCacheIdentifier ( )
final
Returns
string

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

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

Referenced by arObjectCache\flush(), arObjectCache\get(), and arObjectCache\isCached().

22  : string
23  {
24  if ($this->getArFieldList()->getPrimaryField()) {
25  return ($this->getConnectorContainerName() . "_" . $this->getPrimaryFieldValue());
26  }
27 
28  return "";
29  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTTL()

CachedActiveRecord::getTTL ( )

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

31  : int
32  {
33  return 60;
34  }

◆ read()

CachedActiveRecord::read ( )

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

105  {
106  parent::read();
107  }

◆ save()

CachedActiveRecord::save ( )

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

85  {
86  parent::save();
87  }

◆ store()

CachedActiveRecord::store ( )

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

80  {
81  parent::store();
82  }

◆ storeObjectToCache()

CachedActiveRecord::storeObjectToCache ( )

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

67  {
68  parent::storeObjectToCache();
69  }

◆ update()

CachedActiveRecord::update ( )

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

References buildHash(), getCache(), and League\Flysystem\Adapter\Polyfill\update().

Referenced by ilMMItemStorage\create().

110  {
111  if ($this->buildHash() !== $this->_hash) {
112  $this->getCache()->flush();
113  parent::update();
114  }
115  }
update($pash, $contents, Config $config)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $_hash

CachedActiveRecord::$_hash = ''
private

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


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