ILIAS  release_8 Revision v8.24
ilADTActiveRecordWrapper Class Reference

ADT Active Record service wrapper class This class expects a valid primary for all actions! More...

+ Inheritance diagram for ilADTActiveRecordWrapper:
+ Collaboration diagram for ilADTActiveRecordWrapper:

Public Member Functions

 __construct (ilADTGroupActiveRecordBridge $a_properties)
 Constructor. More...
 
 getConnectorContainerName ()
 @description Return the Name of your Connector Table More...
 
 getPrimaryFieldValue ()
 
 sleep ($field_name)
 
 wakeUp ($field_name, $field_value)
 
- 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)
 

Static Public Member Functions

static returnDbTableName ()
 
- 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

 getActiveRecordFieldTypeFromMDB2 (string $a_mdb2_type)
 
 initFieldList ()
 
- Protected Member Functions inherited from ActiveRecord
 installDatabase ()
 

Protected Attributes

ilADTGroupActiveRecordBridge $properties
 
arFieldList $fields
 
arConnectorDB $arConnector
 
array $field_element_map = []
 
- Protected Attributes inherited from ActiveRecord
bool $ar_safe_read = true
 
string $connector_container_name = ''
 
bool $is_new = true
 

Additional Inherited Members

- 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)
 

Detailed Description

ADT Active Record service wrapper class This class expects a valid primary for all actions!

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

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

Constructor & Destructor Documentation

◆ __construct()

ilADTActiveRecordWrapper::__construct ( ilADTGroupActiveRecordBridge  $a_properties)

Constructor.

Parameters
ilADTGroupActiveRecordBridge$a_properties

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

24 {
25 $this->properties = $a_properties;
26 $this->initFieldList();
27 $this->arConnector = new arConnectorDB();
28 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class arConnector.

References initFieldList().

+ Here is the call graph for this function:

Member Function Documentation

◆ getActiveRecordFieldTypeFromMDB2()

ilADTActiveRecordWrapper::getActiveRecordFieldTypeFromMDB2 ( string  $a_mdb2_type)
protected

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

30 : ?string
31 {
32 // currently they are all the same
33 switch ($a_mdb2_type) {
34 case "integer":
36
37 case "float":
39
40 case "text":
42
43 case "date":
45
46 case "timestamp":
48 }
49 return null;
50 }
const FIELD_TYPE_TEXT
const FIELD_TYPE_FLOAT
const FIELD_TYPE_DATE
const FIELD_TYPE_INTEGER
const FIELD_TYPE_TIMESTAMP

References arField\FIELD_TYPE_DATE, arField\FIELD_TYPE_FLOAT, arField\FIELD_TYPE_INTEGER, arField\FIELD_TYPE_TEXT, and arField\FIELD_TYPE_TIMESTAMP.

Referenced by initFieldList().

+ Here is the caller graph for this function:

◆ getConnectorContainerName()

ilADTActiveRecordWrapper::getConnectorContainerName ( )

@description Return the Name of your Connector Table

Reimplemented from ActiveRecord.

Definition at line 81 of file class.ilADTActiveRecordWrapper.php.

81 : string
82 {
83 return $this->properties->getTable();
84 }

◆ getPrimaryFieldValue()

ilADTActiveRecordWrapper::getPrimaryFieldValue ( )
Returns
mixed

Reimplemented from ActiveRecord.

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

91 : string
92 {
93 $primaries = $this->properties->getPrimary();
94 $primary = array_shift($primaries);
95 return $primary[1];
96 }

◆ initFieldList()

ilADTActiveRecordWrapper::initFieldList ( )
protected

Definition at line 52 of file class.ilADTActiveRecordWrapper.php.

52 : void
53 {
54 $this->fields = new arFieldList($this);
55
56 $fields = [];
57 foreach ($this->properties->getActiveRecordFields() as $element_id => $element_fields) {
58 foreach ($element_fields as $field) {
59 $this->field_element_map[$field->getName()] = $element_id;
60 }
61 $fields = array_merge($fields, $element_fields);
62 }
63 $this->fields->setFields($fields);
64
65 // primary
66
67 if (count($this->properties->getPrimary()) > 1) {
68 throw new ilException("ilADTActiveRecordWrapper - no complex primary keys supported yet");
69 }
70
71 foreach ($this->properties->getPrimary() as $primary_id => $primary_element) {
72 $field = new arField();
73 $field->setHasField(true);
74 $field->setNotNull(true);
75 $field->setFieldType($this->getActiveRecordFieldTypeFromMDB2($primary_element[0] ?? ''));
76 $field->setName($primary_id);
77 $this->fields->setPrimaryField($field);
78 }
79 }
Class arFieldList.
Class arField.
getActiveRecordFieldTypeFromMDB2(string $a_mdb2_type)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$errors fields
Definition: imgupload.php:67

References $fields, ActiveRecord\count(), fields, and getActiveRecordFieldTypeFromMDB2().

Referenced by __construct().

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

◆ returnDbTableName()

static ilADTActiveRecordWrapper::returnDbTableName ( )
static
Exceptions

arException

Deprecated:

Reimplemented from ActiveRecord.

Definition at line 86 of file class.ilADTActiveRecordWrapper.php.

86 : string
87 {
88 throw new \RuntimeException('Not implemented yet');
89 }

◆ sleep()

ilADTActiveRecordWrapper::sleep (   $field_name)
Todo:
types extended from ActiveRecord

Reimplemented from ActiveRecord.

Definition at line 101 of file class.ilADTActiveRecordWrapper.php.

102 {
103 if (array_key_exists($field_name, $this->field_element_map)) {
104 $element = $this->properties->getElement($this->field_element_map[$field_name]);
105 return $element->getFieldValue($field_name);
106 }
107 return false;
108 }

◆ wakeUp()

ilADTActiveRecordWrapper::wakeUp (   $field_name,
  $field_value 
)
Todo:
types extended from ActiveRecord

Reimplemented from ActiveRecord.

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

115 {
116 if (array_key_exists($field_name, $this->field_element_map)) {
117 $element = $this->properties->getElement($this->field_element_map[$field_name]);
118 $element->setFieldValue($field_name, $field_value);
119 return true;
120 }
121 return false;
122 }

Field Documentation

◆ $arConnector

arConnectorDB ilADTActiveRecordWrapper::$arConnector
protected

Definition at line 16 of file class.ilADTActiveRecordWrapper.php.

◆ $field_element_map

array ilADTActiveRecordWrapper::$field_element_map = []
protected

Definition at line 17 of file class.ilADTActiveRecordWrapper.php.

◆ $fields

arFieldList ilADTActiveRecordWrapper::$fields
protected

Definition at line 15 of file class.ilADTActiveRecordWrapper.php.

Referenced by initFieldList().

◆ $properties

ilADTGroupActiveRecordBridge ilADTActiveRecordWrapper::$properties
protected

Definition at line 14 of file class.ilADTActiveRecordWrapper.php.


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