ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
CachedActiveRecord Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 getCacheIdentifier ()
 
 getTTL ()
 
 __construct (mixed $primary_key=0, ?arConnector $arConnector=null)
 @inheritDoc More...
 
 afterObjectLoad ()
 
 create ()
 
 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 (mixed $primary_key=0)
 
 storeObjectToCache ()
 
 asStdClass ()
 
 asArray ()
 
 buildFromArray (array $array)
 
 fixDateField ($field_name, string $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=[])
 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=[])
 
static where ($where, $operator=null)
 
static innerjoinAR (ActiveRecord $activeRecord, $on_this, string $on_external, array $fields=[' *'], string $operator='=', bool $both_external=false)
 
static innerjoin (string $tablename, $on_this, string $on_external, array $fields=[' *'], string $operator='=', bool $both_external=false)
 
static leftjoin (string $tablename, $on_this, string $on_external, array $fields=[' *'], string $operator='=', bool $both_external=false)
 
static orderBy (string $orderBy, string $orderDirection='ASC')
 
static dateFormat (string $date_format='d.m.Y - H:i:s')
 
static limit (int $start, int $end)
 
static affectedRows ()
 
static count ()
 
static get ()
 
static debug ()
 
static first ()
 
static getCollection ()
 
static last ()
 
static getFirstFromLastQuery ()
 
static connector (arConnector $arConnector)
 
static raw (bool $set_raw=true)
 
static getArray (?string $key=null, string|array|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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class CachedActiveRecord

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

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

Constructor & Destructor Documentation

◆ __construct()

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

@inheritDoc

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

45 {
46 if (is_null($arConnector)) {
47 $arConnector = new arConnectorDB();
48 }
49
50 $arConnector = new arConnectorCache($arConnector);
51 arConnectorMap::register($this, $arConnector);
52 parent::__construct($primary_key);
53 }
Class ilGSStorageCache.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static register(ActiveRecord $activeRecord, arConnector $arConnector)
__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 55 of file class.CachedActiveRecord.php.

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

References buildHash().

+ Here is the call graph for this function:

◆ buildHash()

CachedActiveRecord::buildHash ( )
private

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

61 : string
62 {
63 $hashing = [];
64 foreach ($this->getArFieldList()->getFields() as $arField) {
65 $name = $arField->getName();
66 $hashing[$name] = $this->{$name};
67 }
68 return md5(serialize($hashing));
69 }

References ActiveRecord\getArFieldList().

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

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

◆ create()

CachedActiveRecord::create ( )

Reimplemented from ActiveRecord.

Reimplemented in ilMMItemStorage.

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

72 : void
73 {
74 parent::create();
75 }

◆ delete()

CachedActiveRecord::delete ( )

Reimplemented from ActiveRecord.

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

93 : void
94 {
95 parent::delete(); // TODO: Change the autogenerated stub
96 }

◆ getCacheIdentifier()

CachedActiveRecord::getCacheIdentifier ( )
final

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

27 : string
28 {
29 if ($this->getArFieldList()->getPrimaryField()) {
30 return ($this->getConnectorContainerName() . "_" . $this->getPrimaryFieldValue());
31 }
32
33 return "";
34 }
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 36 of file class.CachedActiveRecord.php.

36 : int
37 {
38 return 60;
39 }

◆ read()

CachedActiveRecord::read ( )
Exceptions
arException

Reimplemented from ActiveRecord.

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

78 : void
79 {
80 parent::read();
81 $this->_hash = $this->buildHash();
82 }

References buildHash().

+ Here is the call graph for this function:

◆ update()

CachedActiveRecord::update ( )

Reimplemented from ActiveRecord.

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

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

References buildHash().

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 25 of file class.CachedActiveRecord.php.


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