ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ActiveRecord 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 ActiveRecord:
+ Collaboration diagram for ActiveRecord:

Public Member Functions

 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)
 

Static Public Member Functions

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

 installDatabase ()
 

Static Protected Member Functions

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

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 @depracated This service is now deprecated and will be removed with ILIAS 12 or 13 (depending on how quickly users can replace their implementations). The ActiveRecord was a simple way of handling database operations and object mapping in its day. However, the pattern is not very lightweight and has a very large overhead. It also leads to many database queries and high memory consumption. For several releases now, the “Repository Pattern” has been propagated as a better alternative.

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

Constructor & Destructor Documentation

◆ __construct()

ActiveRecord::__construct ( mixed  $primary_key = 0)

Definition at line 96 of file class.ActiveRecord.php.

97 {
98 $arFieldList = arFieldCache::get($this);
99
100 $primaryFieldName = $arFieldList->getPrimaryFieldName();
101 $this->{$primaryFieldName} = $primary_key;
102 if ($primary_key === 0) {
103 return;
104 }
105 if ($primary_key === null) {
106 return;
107 }
108 if ($primary_key === false) {
109 return;
110 }
111 $this->read();
112 }
static get(ActiveRecord $activeRecord)

References arFieldCache\get(), and read().

+ Here is the call graph for this function:

Member Function Documentation

◆ __call()

ActiveRecord::__call (   $name,
  $arguments 
)
Parameters
$name
$arguments
Returns
mixed @noinspection PhpInconsistentReturnPointsInspection since this a dynamic call

Definition at line 700 of file class.ActiveRecord.php.

701 {
702 // Getter
703 if (preg_match("/get([a-zA-Z]*)/u", (string) $name, $matches) && (is_countable($arguments) ? count(
704 $arguments
705 ) : 0) === 0) {
706 return $this->{self::fromCamelCase($matches[1])};
707 }
708 // Setter
709 if (!preg_match("/set([a-zA-Z]*)/u", (string) $name, $matches)) {
710 return null;
711 }
712 if (count($arguments) !== 1) {
713 return null;
714 }
715 $this->{self::fromCamelCase($matches[1])} = $arguments[0];
716 return null;
717 }
static fromCamelCase(string $str)

◆ _toCamelCase()

static ActiveRecord::_toCamelCase ( string  $str,
bool  $capitalise_first_char = false 
)
static

Definition at line 719 of file class.ActiveRecord.php.

719 : ?string
720 {
721 if ($capitalise_first_char) {
722 $str[0] = strtoupper($str[0]);
723 }
724
725 return preg_replace_callback('/_([a-z])/', fn($c): string => strtoupper($c[1]), $str);
726 }
$c
Definition: deliver.php:25

References $c.

◆ additionalParams()

static ActiveRecord::additionalParams ( array  $additional_params)
static
Returns
$this

Definition at line 430 of file class.ActiveRecord.php.

431 {
432 $activeRecordList = new ActiveRecordList(self::getCalledClass());
433 $activeRecordList->additionalParams($additional_params);
434
435 return $activeRecordList;
436 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ affectedRows()

static ActiveRecord::affectedRows ( )
static

Definition at line 607 of file class.ActiveRecord.php.

607 : int
608 {
609 $activeRecordList = new ActiveRecordList(self::getCalledClass());
610
611 return $activeRecordList->affectedRows();
612 }

◆ afterObjectLoad()

ActiveRecord::afterObjectLoad ( )

Reimplemented in CachedActiveRecord, and ilDclFieldProperty.

Definition at line 376 of file class.ActiveRecord.php.

376 : void
377 {
378 }

◆ asArray()

ActiveRecord::asArray ( )
Returns
array<string, mixed>

Definition at line 133 of file class.ActiveRecord.php.

133 : array
134 {
135 $return = [];
136 foreach ($this->getArFieldList()->getFields() as $arField) {
137 $fieldname = $arField->getName();
138 $return[$fieldname] = $this->{$fieldname};
139 }
140
141 return $return;
142 }

Referenced by arConnectorCache\storeActiveRecordInCache().

+ Here is the caller graph for this function:

◆ asStdClass()

ActiveRecord::asStdClass ( )

Definition at line 119 of file class.ActiveRecord.php.

119 : \stdClass
120 {
121 $return = new stdClass();
122 foreach ($this->getArFieldList()->getFields() as $arField) {
123 $fieldname = $arField->getName();
124 $return->{$fieldname} = $this->{$fieldname};
125 }
126
127 return $return;
128 }

References getArFieldList().

Referenced by arConnectorSession\create().

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

◆ buildFromArray()

ActiveRecord::buildFromArray ( array  $array)

Reimplemented in ilAccessibilityDocument.

Definition at line 144 of file class.ActiveRecord.php.

144 : static
145 {
146 $class = static::class;
147 $primary = $this->getArFieldList()->getPrimaryFieldName();
148 $primary_value = $array[$primary];
149 if ($primary_value && arObjectCache::isCached($class, $primary_value)) {
150 return arObjectCache::get($class, $primary_value);
151 }
152 foreach ($array as $field_name => $value) {
153 $waked = $this->wakeUp($field_name, $value);
154 $this->{$field_name} = $waked ?? $value;
155 }
157
158 return $this;
159 }
wakeUp($field_name, $field_value)
static isCached($class, $id)
static get(string $class, string $id)
static store(ActiveRecord $activeRecord)

References arObjectCache\get(), arObjectCache\isCached(), and arObjectCache\store().

+ Here is the call graph for this function:

◆ connector()

static ActiveRecord::connector ( arConnector  $arConnector)
static

Definition at line 666 of file class.ActiveRecord.php.

667 {
668 $activeRecordList = new ActiveRecordList(self::getCalledClass());
669
670 return $activeRecordList->connector($arConnector);
671 }

◆ copy()

ActiveRecord::copy ( int  $new_id = 0)
Exceptions
arException

Definition at line 365 of file class.ActiveRecord.php.

365 : self
366 {
367 if (self::where([$this->getArFieldList()->getPrimaryFieldName() => $new_id])->hasSets()) {
369 }
370 $new_obj = clone($this);
371 $new_obj->setPrimaryFieldValue($new_id);
372
373 return $new_obj;
374 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const COPY_DESTINATION_ID_EXISTS

References arException\COPY_DESTINATION_ID_EXISTS.

◆ count()

static ActiveRecord::count ( )
static

Definition at line 614 of file class.ActiveRecord.php.

614 : int
615 {
616 return self::affectedRows();
617 }

Referenced by ilAccessibilityDocument\detachCriterion(), and ILIAS\UI\Implementation\Component\Table\AbstractTable\getColumnCount().

+ Here is the caller graph for this function:

◆ create()

ActiveRecord::create ( )

Reimplemented in ilAccessibilityDocumentCriterionAssignment, CachedActiveRecord, ilADNNotification, ilDclFieldProperty, and ilMMItemStorage.

Definition at line 351 of file class.ActiveRecord.php.

351 : void
352 {
353 if ($this->getArFieldList()->getPrimaryField()->getSequence()) {
354 $primary_fieldname = arFieldCache::getPrimaryFieldName($this);
355 $this->{$primary_fieldname} = $this->getArConnector()->nextID($this);
356 }
357
358 $this->getArConnector()->create($this);
360 }
static getPrimaryFieldName(ActiveRecord $activeRecord)

References arFieldCache\getPrimaryFieldName(), and arObjectCache\store().

Referenced by ilDclTableView\cloneStructure(), ilDclTableViewFieldSetting\cloneStructure(), and ilOrgUnitPathStorage\store().

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

◆ dateFormat()

static ActiveRecord::dateFormat ( string  $date_format = 'd.m.Y - H:i:s')
static

Definition at line 587 of file class.ActiveRecord.php.

587 :i:s'): \ActiveRecordList
588 {
589 $activeRecordList = new ActiveRecordList(self::getCalledClass());
590 $activeRecordList->dateFormat($date_format);
591
592 return $activeRecordList;
593 }

◆ debug()

static ActiveRecord::debug ( )
static

Definition at line 629 of file class.ActiveRecord.php.

630 {
631 $activeRecordList = new ActiveRecordList(self::getCalledClass());
632
633 return $activeRecordList->debug();
634 }

◆ delete()

ActiveRecord::delete ( )

Reimplemented in CachedActiveRecord, and ilDclTableView.

Definition at line 408 of file class.ActiveRecord.php.

408 : void
409 {
410 $this->getArConnector()->delete($this);
412 }
static purge(ActiveRecord $activeRecord)

References arObjectCache\purge().

+ Here is the call graph for this function:

◆ fieldExists()

static ActiveRecord::fieldExists ( string  $field_name)
staticfinal
Parameters
$field_name

Definition at line 263 of file class.ActiveRecord.php.

263 : bool
264 {
265 return self::getCalledClass()->getArConnector()->checkFieldExists(self::getCalledClass(), $field_name);
266 }
static getCalledClass()
@description Returns an instance of the instatiated calling active record (needs to be done in static...

◆ findOrFail()

static ActiveRecord::findOrFail (   $primary_key,
array  $add_constructor_args = [] 
)
static

Tries to find the object and throws an Exception if object is not found, instead of returning null.

Parameters
$primary_key
Exceptions
arException

Definition at line 472 of file class.ActiveRecord.php.

473 {
474 $obj = self::find($primary_key, $add_constructor_args);
475 if (is_null($obj)) {
477 }
478
479 return $obj;
480 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References arException\RECORD_NOT_FOUND.

Referenced by ilSecurePathDefinitionProcessor\beginTag(), ilBiblLibraryFactory\findById(), ilBiblTranslationFactory\findById(), and ilADNNotificationGUI\getNotificationsFromRequest().

+ Here is the caller graph for this function:

◆ findOrGetInstance()

static ActiveRecord::findOrGetInstance (   $primary_key,
array  $add_constructor_args = [] 
)
static
Parameters
$primary_key@description Returns an existing Object with given primary-key or a new Instance with given primary-key set but not yet created
Returns
\ActiveRecord|object|void

Reimplemented in ilDclTableView.

Definition at line 487 of file class.ActiveRecord.php.

488 {
489 $obj = self::find($primary_key, $add_constructor_args);
490 if ($obj !== null) {
491 return $obj;
492 }
493
494 $class_name = static::class;
495 $obj = arFactory::getInstance($class_name, 0, $add_constructor_args);
496 $obj->setPrimaryFieldValue($primary_key);
497 $obj->is_new = true;
498 $obj->storeObjectToCache();
499
500 return $obj;
501 }

◆ first()

static ActiveRecord::first ( )
static

Definition at line 636 of file class.ActiveRecord.php.

637 {
638 $activeRecordList = new ActiveRecordList(self::getCalledClass());
639
640 return $activeRecordList->first();
641 }

Referenced by ilDclTableView\createOrGetStandardView(), ilDclTableViewFieldSetting\getInstance(), and ilDclTableViewFieldSetting\getTableViewFieldSetting().

+ Here is the caller graph for this function:

◆ fixDateField()

ActiveRecord::fixDateField (   $field_name,
string  $value 
)
Parameters
$field_name
$value
Returns
string|mixed @noinspection NullPointerExceptionInspection

Definition at line 167 of file class.ActiveRecord.php.

168 {
169 if ($this->getArFieldList()->getFieldByName($field_name)->isDateField()) {
170 return $this->getArConnector()->fixDate($value);
171 }
172
173 return $value;
174 }

◆ flushDB()

static ActiveRecord::flushDB ( )
staticfinal

@depracated never use in ILIAS Core, Plugins only

Definition at line 326 of file class.ActiveRecord.php.

326 : void
327 {
329 }

Referenced by ilMMTopItemGUI\restore().

+ Here is the caller graph for this function:

◆ fromCamelCase()

static ActiveRecord::fromCamelCase ( string  $str)
staticprotected

Definition at line 728 of file class.ActiveRecord.php.

728 : ?string
729 {
730 $str[0] = strtolower($str[0]);
731
732 return preg_replace_callback('/([A-Z])/', fn($c): string => "_" . strtolower($c[1]), $str);
733 }

References $c.

◆ get()

static ActiveRecord::get ( )
static
Returns
ActiveRecord[]

Definition at line 622 of file class.ActiveRecord.php.

622 : array
623 {
624 $activeRecordList = new ActiveRecordList(self::getCalledClass());
625
626 return $activeRecordList->get();
627 }

Referenced by ilBiblLibraryFactory\getAll(), and ilADNNotificationGUI\getNotificationsFromRequest().

+ Here is the caller graph for this function:

◆ getArConnector()

ActiveRecord::getArConnector ( )

Definition at line 33 of file class.ActiveRecord.php.

34 {
35 return arConnectorMap::get($this);
36 }
static get(ActiveRecord $activeRecord)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References arConnectorMap\get().

Referenced by arWhere\asSQLStatement().

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

◆ getArFieldList()

ActiveRecord::getArFieldList ( )

Definition at line 38 of file class.ActiveRecord.php.

39 {
40 return arFieldCache::get($this);
41 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References arFieldCache\get().

Referenced by arWhere\asSQLStatement(), asStdClass(), CachedActiveRecord\buildHash(), CachedActiveRecord\getCacheIdentifier(), arConnectorDB\installDatabase(), arConnectorDB\updateDatabase(), and arConnectorDB\updateIndices().

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

◆ getArray()

static ActiveRecord::getArray ( ?string  $key = null,
string|array|null  $values = null 
)
static
Parameters
null$values
Returns
mixed[]|mixed[][]|int[]|string[]|null[]

Definition at line 684 of file class.ActiveRecord.php.

684 : array
685 {
686 $activeRecordList = new ActiveRecordList(self::getCalledClass());
687
688 return $activeRecordList->getArray($key, $values);
689 }

Referenced by ilMMItemInformation\__construct(), ilMMAbstractBaseTypeHandlerAction\__construct(), ILIAS\AdministrativeNotification\DataRetrieval\getRecords(), and ilOrgUnitPathStorage\getTextRepresentationOfOrgUnits().

+ Here is the caller graph for this function:

◆ getArrayForConnector()

ActiveRecord::getArrayForConnector ( )
final
Returns
array<string, mixed[]>

Definition at line 198 of file class.ActiveRecord.php.

198 : array
199 {
200 $data = [];
201 foreach ($this->getArFieldList()->getFields() as $arField) {
202 $field_name = $arField->getName();
203 $sleeped = $this->sleep($field_name);
204 $var = $sleeped ?? ($this->{$field_name});
205 $data[$field_name] = [$arField->getFieldType(), $var];
206 }
207
208 return $data;
209 }
sleep($field_name)

References $data.

Referenced by arConnectorDB\create(), and arConnectorDB\update().

+ Here is the caller graph for this function:

◆ getCalledClass()

static ActiveRecord::getCalledClass ( )
staticprotected

@description Returns an instance of the instatiated calling active record (needs to be done in static methods) @TODO : This should be cached somehow

Definition at line 221 of file class.ActiveRecord.php.

222 {
223 $class = static::class;
224
225 return arCalledClassCache::get($class);
226 }
static get(string $class_name)

References arCalledClassCache\get().

Referenced by getConnectorContainerName().

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

◆ getCollection()

static ActiveRecord::getCollection ( )
static

Definition at line 643 of file class.ActiveRecord.php.

644 {
645 return new ActiveRecordList(self::getCalledClass());
646 ;
647 }

Referenced by ilDclTableViewBaseDefaultValue\findAll(), and ilBiblFieldFactory\getCollectionForFilter().

+ Here is the caller graph for this function:

◆ getConnectorContainerName()

ActiveRecord::getConnectorContainerName ( )

◆ getFirstFromLastQuery()

static ActiveRecord::getFirstFromLastQuery ( )
static
Deprecated:

Definition at line 659 of file class.ActiveRecord.php.

660 {
661 $activeRecordList = new ActiveRecordList(self::getCalledClass());
662
663 return $activeRecordList->getFirstFromLastQuery();
664 }

◆ getPrimaryFieldValue()

ActiveRecord::getPrimaryFieldValue ( )
Returns
mixed

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

80 {
81 $primary_fieldname = arFieldCache::getPrimaryFieldName($this);
82
83 return $this->{$primary_fieldname};
84 }

References arFieldCache\getPrimaryFieldName().

Referenced by arConnectorCache\buildCacheKey(), arConnectorSession\create(), CachedActiveRecord\getCacheIdentifier(), arObjectCache\purge(), arConnectorDB\read(), arConnectorSession\read(), arObjectCache\store(), and arConnectorDB\update().

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

◆ innerjoin()

static ActiveRecord::innerjoin ( string  $tablename,
  $on_this,
string  $on_external,
array  $fields = ['*'],
string  $operator = '=',
bool  $both_external = false 
)
static
Parameters
$tablename
$on_this
$on_external
Returns
$this

Definition at line 544 of file class.ActiveRecord.php.

552 $activeRecordList = new ActiveRecordList(self::getCalledClass());
553
554 return $activeRecordList->innerjoin($tablename, $on_this, $on_external, $fields, $operator, $both_external);
555 }

◆ innerjoinAR()

static ActiveRecord::innerjoinAR ( ActiveRecord  $activeRecord,
  $on_this,
string  $on_external,
array  $fields = ['*'],
string  $operator = '=',
bool  $both_external = false 
)
static
Parameters
$on_this
$on_external
Returns
$this

Definition at line 520 of file class.ActiveRecord.php.

528 return self::innerjoin(
529 $activeRecord->getConnectorContainerName(),
530 $on_this,
531 $on_external,
532 $fields,
533 $operator,
534 $both_external
535 );
536 }
getConnectorContainerName()
@description Return the Name of your Connector Table
static innerjoin(string $tablename, $on_this, string $on_external, array $fields=[' *'], string $operator='=', bool $both_external=false)

◆ installConnector()

ActiveRecord::installConnector ( )
Deprecated:
Do not use in Core DB-update.

Definition at line 241 of file class.ActiveRecord.php.

241 : bool
242 {
243 return $this->installDatabase();
244 }

◆ installDatabase()

ActiveRecord::installDatabase ( )
finalprotected
Deprecated:
never use in ILIAS Core, Plugins only

Definition at line 279 of file class.ActiveRecord.php.

279 : bool
280 {
281 if (!self::tableExists()) {
282 $fields = [];
283 foreach ($this->getArFieldList()->getFields() as $arField) {
284 $fields[$arField->getName()] = $arField->getAttributesForConnector();
285 }
286
287 return $this->getArConnector()->installDatabase($this, $fields);
288 }
289
290 return $this->getArConnector()->updateDatabase($this);
291 }

◆ installDB()

static ActiveRecord::installDB ( )
staticfinal
Deprecated:
Do not use in Core DB-update. Please generate the manual installation script by using: $arBuilder = new arBuilder(new ilYourARBasedClass()); $arBuilder->generateDBUpdateForInstallation();

Definition at line 233 of file class.ActiveRecord.php.

233 : bool
234 {
235 return self::getCalledClass()->installDatabase();
236 }

Referenced by arConnectorDB\resetDatabase().

+ Here is the caller graph for this function:

◆ last()

static ActiveRecord::last ( )
static

Definition at line 649 of file class.ActiveRecord.php.

650 {
651 $activeRecordList = new ActiveRecordList(self::getCalledClass());
652
653 return $activeRecordList->last();
654 }

◆ leftjoin()

static ActiveRecord::leftjoin ( string  $tablename,
  $on_this,
string  $on_external,
array  $fields = ['*'],
string  $operator = '=',
bool  $both_external = false 
)
static
Parameters
$tablename
$on_this
$on_external
Returns
$this

Definition at line 563 of file class.ActiveRecord.php.

571 $activeRecordList = new ActiveRecordList(self::getCalledClass());
572
573 return $activeRecordList->leftjoin($tablename, $on_this, $on_external, $fields, $operator, $both_external);
574 }

◆ limit()

static ActiveRecord::limit ( int  $start,
int  $end 
)
static
Parameters
$start
$end

Definition at line 599 of file class.ActiveRecord.php.

600 {
601 $activeRecordList = new ActiveRecordList(self::getCalledClass());
602 $activeRecordList->limit($start, $end);
603
604 return $activeRecordList;
605 }

◆ orderBy()

static ActiveRecord::orderBy ( string  $orderBy,
string  $orderDirection = 'ASC' 
)
static
Parameters
$orderBy

Definition at line 579 of file class.ActiveRecord.php.

580 {
581 $activeRecordList = new ActiveRecordList(self::getCalledClass());
582 $activeRecordList->orderBy($orderBy, $orderDirection);
583
584 return $activeRecordList;
585 }

Referenced by ilDclTableView\createOrGetStandardView(), ilAccessibilityDocumentTableDataProvider\getList(), ilOrgUnitPathStorage\getTextRepresentationOfOrgUnits(), ilDclSelectionOption\getValues(), and ilInitialisation\initAccessibilityControlConcept().

+ Here is the caller graph for this function:

◆ preloadObjects()

static ActiveRecord::preloadObjects ( )
static
Returns
ActiveRecord[]

Definition at line 422 of file class.ActiveRecord.php.

422 : array
423 {
424 return self::get();
425 }

References ILIAS\GlobalScreen\get().

+ Here is the call graph for this function:

◆ raw()

static ActiveRecord::raw ( bool  $set_raw = true)
static

Definition at line 673 of file class.ActiveRecord.php.

674 {
675 $activeRecordList = new ActiveRecordList(self::getCalledClass());
676
677 return $activeRecordList->raw($set_raw);
678 }

◆ read()

ActiveRecord::read ( )
Exceptions
arException

Reimplemented in ilAccessibilityDocument, and CachedActiveRecord.

Definition at line 383 of file class.ActiveRecord.php.

383 : void
384 {
385 $records = $this->getArConnector()->read($this);
386 if ($this->ar_safe_read && is_array($records) && $records === []) {
388 }
389 if (!$this->ar_safe_read && is_array($records) && $records === []) {
390 $this->is_new = true;
391 }
392 $records = is_array($records) ? $records : [];
393 foreach ($records as $record) {
394 foreach (array_keys($this->getArrayForConnector()) as $k) {
395 $waked = $this->wakeUp($k, $record->{$k} ?? null);
396 $this->{$k} = $waked ?? $record->{$k} ?? null;
397 }
399 }
400 }

References arException\RECORD_NOT_FOUND.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ removeDBField()

static ActiveRecord::removeDBField ( string  $field_name)
staticfinal
Deprecated:
never use in ILIAS Core, Plugins only

Definition at line 271 of file class.ActiveRecord.php.

271 : bool
272 {
273 return self::getCalledClass()->getArConnector()->removeField(self::getCalledClass(), $field_name);
274 }

◆ renameDBField()

static ActiveRecord::renameDBField ( string  $old_name,
string  $new_name 
)
staticfinal
Parameters
$old_name
$new_name

Definition at line 250 of file class.ActiveRecord.php.

250 : bool
251 {
252 return self::getCalledClass()->getArConnector()->renameField(self::getCalledClass(), $old_name, $new_name);
253 }

◆ resetDB()

static ActiveRecord::resetDB ( )
staticfinal
Deprecated:
never use in ILIAS Core, Plugins only

Definition at line 310 of file class.ActiveRecord.php.

310 : bool
311 {
312 return self::getCalledClass()->getArConnector()->resetDatabase(self::getCalledClass());
313 }

◆ returnDbTableName()

◆ save()

ActiveRecord::save ( )

Definition at line 346 of file class.ActiveRecord.php.

346 : void
347 {
348 $this->store();
349 }

◆ setConnectorContainerName()

ActiveRecord::setConnectorContainerName ( string  $connector_container_name)

Definition at line 71 of file class.ActiveRecord.php.

71 : void
72 {
73 $this->connector_container_name = $connector_container_name;
74 }

References $connector_container_name.

◆ setPrimaryFieldValue()

ActiveRecord::setPrimaryFieldValue (   $value)
Parameters
$value

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

89 : void
90 {
91 $primary_fieldname = arFieldCache::getPrimaryFieldName($this);
92
93 $this->{$primary_fieldname} = $value;
94 }

References arFieldCache\getPrimaryFieldName().

+ Here is the call graph for this function:

◆ sleep()

ActiveRecord::sleep (   $field_name)
Parameters
$field_name
Returns
null

Reimplemented in ilDclTableView, and ilDclTableViewFieldSetting.

Definition at line 180 of file class.ActiveRecord.php.

181 {
182 return null;
183 }

◆ store()

ActiveRecord::store ( )

Reimplemented in ilOrgUnitPathStorage.

Definition at line 334 of file class.ActiveRecord.php.

334 : void
335 {
336 $primary_fieldname = arFieldCache::getPrimaryFieldName($this);
337 $primary_value = $this->getPrimaryFieldValue();
338
339 if (!self::where([$primary_fieldname => $primary_value])->hasSets()) {
340 $this->create();
341 } else {
342 $this->update();
343 }
344 }

References arFieldCache\getPrimaryFieldName().

+ Here is the call graph for this function:

◆ storeObjectToCache()

ActiveRecord::storeObjectToCache ( )

Definition at line 114 of file class.ActiveRecord.php.

114 : void
115 {
117 }

References arObjectCache\store().

+ Here is the call graph for this function:

◆ tableExists()

static ActiveRecord::tableExists ( )
staticfinal

Definition at line 255 of file class.ActiveRecord.php.

255 : bool
256 {
257 return self::getCalledClass()->getArConnector()->checkTableExists(self::getCalledClass());
258 }

◆ truncateDB()

static ActiveRecord::truncateDB ( )
staticfinal
Deprecated:
never use in ILIAS Core, Plugins only

Definition at line 318 of file class.ActiveRecord.php.

318 : void
319 {
320 self::getCalledClass()->getArConnector()->truncateDatabase(self::getCalledClass());
321 }

◆ update()

ActiveRecord::update ( )

Reimplemented in ilAccessibilityDocumentCriterionAssignment, CachedActiveRecord, and ilDclFieldProperty.

Definition at line 402 of file class.ActiveRecord.php.

402 : void
403 {
404 $this->getArConnector()->update($this);
406 }

References arObjectCache\store().

Referenced by ilAccessibilityDocumentGUI\detachCriterionAssignment(), and ilOrgUnitPathStorage\store().

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

◆ updateDB()

static ActiveRecord::updateDB ( )
staticfinal
Deprecated:
never use in ILIAS Core, Plugins only

Definition at line 296 of file class.ActiveRecord.php.

296 : bool
297 {
298 if (!self::tableExists()) {
299 self::getCalledClass()->installDatabase();
300
301 return true;
302 }
303
304 return self::getCalledClass()->getArConnector()->updateDatabase(self::getCalledClass());
305 }

◆ wakeUp()

ActiveRecord::wakeUp (   $field_name,
  $field_value 
)
Parameters
$field_name
$field_value
Returns
null

Reimplemented in ilADNNotification, ilDclTableView, and ilDclTableViewFieldSetting.

Definition at line 190 of file class.ActiveRecord.php.

191 {
192 return null;
193 }

◆ where()

static ActiveRecord::where (   $where,
  $operator = null 
)
static
Parameters
$where
null$operator

Definition at line 507 of file class.ActiveRecord.php.

508 {
509 $activeRecordList = new ActiveRecordList(self::getCalledClass());
510 $activeRecordList->where($where, $operator);
511
512 return $activeRecordList;
513 }

Referenced by ilDclTableView\createFieldSetting(), ilMMAbstractItemFacade\deleteAssociatedTranslations(), ilBiblEntryFactory\deleteEntryById(), ilBiblFieldFilterFactory\filterItemsForTable(), ilBiblFieldFilterFactory\findByFieldId(), ilBiblFieldFilterFactory\findById(), ilBiblEntryFactory\findByIdAndTypeString(), ilBiblFieldFactory\findOrCreateFieldOfAttribute(), ilBiblEntryFactory\getAllAttributesByEntryId(), ilDclSelectionOption\getAllForField(), ilBiblFieldFilterFactory\getAllForObjectId(), ilDclTableView\getAllForTableId(), ilBiblEntryFactory\getARInstance(), ilBiblFieldFactory\getARInstance(), ilBiblAttributeFactory\getAttributesForEntry(), ILIAS\BackgroundTasks\Implementation\Persistence\BasicPersistence\getBucketIdsByState(), ILIAS\BackgroundTasks\Implementation\Persistence\BasicPersistence\getBucketIdsOfUser(), ILIAS\BackgroundTasks\Implementation\Persistence\BasicPersistence\getBucketMetaOfUser(), ilBiblFieldFilterFactory\getByObjectIdAndField(), ilBiblTranslationFactory\getCollectionOfTranslationsForField(), ilDclTableView\getCountForTableId(), ilAccessibilityDocumentGUI\getDocumentsByServerRequest(), ilDclCache\getFieldProperties(), ilDclTableView\getFieldSetting(), ilDclTableView\getFieldSettings(), ilDclTableView\getFilterableFieldSettings(), ilBiblDataFactory\getIlBiblDataById(), ilDclTableFieldSetting\getInstance(), ilMMItemRepository\getTopItems(), ilDclBaseFieldModel\getViewSettings(), ilDclTableView\getVisibleFields(), ilADNDismiss\hasDimissed(), ilBiblEntryFactory\loadParsedAttributesByEntryId(), ilDclCache\preloadFieldProperties(), and ilADNNotification\resetForAllUsers().

+ Here is the caller graph for this function:

Field Documentation

◆ $ar_safe_read

bool ActiveRecord::$ar_safe_read = true
protected

Definition at line 29 of file class.ActiveRecord.php.

◆ $connector_container_name

string ActiveRecord::$connector_container_name = ''
protected

Definition at line 30 of file class.ActiveRecord.php.

Referenced by getConnectorContainerName(), and setConnectorContainerName().

◆ $is_new

bool ActiveRecord::$is_new = true
protected

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


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