ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilADTGroupDBBridge Class Reference
+ Inheritance diagram for ilADTGroupDBBridge:
+ Collaboration diagram for ilADTGroupDBBridge:

Public Member Functions

 getElements ()
 
 getElement (string $a_element_id)
 
 setTable (string $a_table)
 
 setPrimary (array $a_value)
 
 readRecord (array $a_row)
 
 prepareInsert (array &$a_fields)
 
 afterInsert ()
 
 afterUpdate ()
 
 afterUpdateElement (string $field_type, string $field_name, int $field_id)
 
 afterDelete ()
 
- Public Member Functions inherited from ilADTDBBridge
 __construct (ilADT $a_adt)
 Constructor. More...
 
 getADT ()
 
 setTable (string $a_table)
 
 getTable ()
 
 setElementId (string $a_value)
 Set element id (aka DB column[s] [prefix]) More...
 
 getElementId ()
 Get element id. More...
 
 setPrimary (array $a_value)
 Set primary fields (in MDB2 format) More...
 
 getAdditionalPrimaryFields ()
 
 getPrimary ()
 Get primary fields. More...
 
 buildPrimaryWhere ()
 Convert primary keys array to sql string. More...
 
 readRecord (array $a_row)
 Import DB values to ADT. More...
 
 prepareInsert (array &$a_fields)
 Prepare ADT values for insert. More...
 
 afterInsert ()
 After insert hook to enable sub-tables. More...
 
 prepareUpdate (array &$a_fields)
 
 afterUpdate ()
 After update hook to enable sub-tables. More...
 
 afterDelete ()
 After delete hook to enable sub-tables. More...
 
 supportsDefaultValueColumn ()
 true if table storage relies on the default 'value' column More...
 

Protected Member Functions

 isValidADT (ilADT $a_adt)
 
 prepareElements ()
 
- Protected Member Functions inherited from ilADTDBBridge
 isValidADT (ilADT $a_adt)
 
 setADT (ilADT $a_adt)
 

Protected Attributes

array $elements = []
 
- Protected Attributes inherited from ilADTDBBridge
ilADT $adt
 
string $table
 
string $id
 
array $primary = []
 
ilDBInterface $db
 

Detailed Description

Definition at line 5 of file class.ilADTGroupDBBridge.php.

Member Function Documentation

◆ afterDelete()

ilADTGroupDBBridge::afterDelete ( )

Definition at line 127 of file class.ilADTGroupDBBridge.php.

References getElements().

127  : void
128  {
129  foreach ($this->getElements() as $element) {
130  $element->afterDelete();
131  }
132  }
+ Here is the call graph for this function:

◆ afterInsert()

ilADTGroupDBBridge::afterInsert ( )

Definition at line 90 of file class.ilADTGroupDBBridge.php.

References getElements().

90  : void
91  {
92  foreach ($this->getElements() as $element) {
93  $element->afterInsert();
94  }
95  }
+ Here is the call graph for this function:

◆ afterUpdate()

ilADTGroupDBBridge::afterUpdate ( )

Definition at line 97 of file class.ilADTGroupDBBridge.php.

References getElements().

97  : void
98  {
99  foreach ($this->getElements() as $element) {
100  $element->afterUpdate();
101  }
102  }
+ Here is the call graph for this function:

◆ afterUpdateElement()

ilADTGroupDBBridge::afterUpdateElement ( string  $field_type,
string  $field_name,
int  $field_id 
)
Parameters
string$field_type
string$field_name
int$field_id

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

References getElement(), and ilADTDBBridge\getPrimary().

110  {
111  $element = $this->getElement((string) $field_id);
112  if (!$element) {
113  return;
114  }
115  $element->setPrimary(
116  array_merge(
117  $this->getPrimary(),
118  [
119  $field_name => [$field_type, $field_id]
120  ]
121  )
122  );
123  $element->setElementId((string) $field_id);
124  $element->afterUpdate();
125  }
getPrimary()
Get primary fields.
getElement(string $a_element_id)
+ Here is the call graph for this function:

◆ getElement()

ilADTGroupDBBridge::getElement ( string  $a_element_id)

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

References getElements().

Referenced by afterUpdateElement().

44  : ?ilADTDBBridge
45  {
46  if (array_key_exists($a_element_id, $this->getElements())) {
47  return $this->elements[$a_element_id];
48  }
49  return null;
50  }
ADT DB bridge base class.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getElements()

ilADTGroupDBBridge::getElements ( )
Returns
ilADTDBBridge[]

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

References $elements, and prepareElements().

Referenced by afterDelete(), afterInsert(), afterUpdate(), getElement(), prepareElements(), prepareInsert(), readRecord(), setPrimary(), and setTable().

38  : array
39  {
40  $this->prepareElements();
41  return $this->elements;
42  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isValidADT()

ilADTGroupDBBridge::isValidADT ( ilADT  $a_adt)
protected

Definition at line 9 of file class.ilADTGroupDBBridge.php.

9  : bool
10  {
11  return ($a_adt instanceof ilADTGroup);
12  }

◆ prepareElements()

ilADTGroupDBBridge::prepareElements ( )
protected

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

References $factory, $name, ilADTDBBridge\getADT(), getElements(), ilADTFactory\getInstance(), ilADTDBBridge\getPrimary(), and ilADTDBBridge\getTable().

Referenced by getElements().

16  : void
17  {
18  if (count($this->elements)) {
19  return;
20  }
21 
22  $this->elements = array();
24 
25  // convert ADTs to DB bridges
26 
27  foreach ($this->getADT()->getElements() as $name => $element) {
28  $this->elements[$name] = $factory->getDBBridgeForInstance($element);
29  $this->elements[$name]->setElementId((string) $name);
30  $this->elements[$name]->setTable($this->getTable());
31  $this->elements[$name]->setPrimary($this->getPrimary());
32  }
33  }
getPrimary()
Get primary fields.
if($format !==null) $name
Definition: metadata.php:247
$factory
Definition: metadata.php:75
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ prepareInsert()

ilADTGroupDBBridge::prepareInsert ( array &  $a_fields)

Definition at line 83 of file class.ilADTGroupDBBridge.php.

References getElements().

83  : void
84  {
85  foreach ($this->getElements() as $element) {
86  $element->prepareInsert($a_fields);
87  }
88  }
+ Here is the call graph for this function:

◆ readRecord()

ilADTGroupDBBridge::readRecord ( array  $a_row)

Definition at line 76 of file class.ilADTGroupDBBridge.php.

References getElements().

76  : void
77  {
78  foreach ($this->getElements() as $element) {
79  $element->readRecord($a_row);
80  }
81  }
+ Here is the call graph for this function:

◆ setPrimary()

ilADTGroupDBBridge::setPrimary ( array  $a_value)

Definition at line 63 of file class.ilADTGroupDBBridge.php.

References $name, ilADTDBBridge\getADT(), getElements(), and ilADTDBBridge\getPrimary().

63  : void
64  {
65  parent::setPrimary($a_value);
66 
67  if (count($this->elements)) {
68  foreach (array_keys($this->getADT()->getElements()) as $name) {
69  $this->elements[$name]->setPrimary($this->getPrimary());
70  }
71  }
72  }
getPrimary()
Get primary fields.
if($format !==null) $name
Definition: metadata.php:247
+ Here is the call graph for this function:

◆ setTable()

ilADTGroupDBBridge::setTable ( string  $a_table)

Definition at line 53 of file class.ilADTGroupDBBridge.php.

References $name, ilADTDBBridge\getADT(), getElements(), and ilADTDBBridge\getTable().

53  : void
54  {
55  parent::setTable($a_table);
56  if (count($this->elements)) {
57  foreach (array_keys($this->getADT()->getElements()) as $name) {
58  $this->elements[$name]->setTable($this->getTable());
59  }
60  }
61  }
if($format !==null) $name
Definition: metadata.php:247
+ Here is the call graph for this function:

Field Documentation

◆ $elements

array ilADTGroupDBBridge::$elements = []
protected

Definition at line 7 of file class.ilADTGroupDBBridge.php.

Referenced by getElements().


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