ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
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 21 of file class.ilADTGroupDBBridge.php.

Member Function Documentation

◆ afterDelete()

ilADTGroupDBBridge::afterDelete ( )

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

References getElements().

143  : void
144  {
145  foreach ($this->getElements() as $element) {
146  $element->afterDelete();
147  }
148  }
+ Here is the call graph for this function:

◆ afterInsert()

ilADTGroupDBBridge::afterInsert ( )

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

References getElements().

106  : void
107  {
108  foreach ($this->getElements() as $element) {
109  $element->afterInsert();
110  }
111  }
+ Here is the call graph for this function:

◆ afterUpdate()

ilADTGroupDBBridge::afterUpdate ( )

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

References getElements().

113  : void
114  {
115  foreach ($this->getElements() as $element) {
116  $element->afterUpdate();
117  }
118  }
+ 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 125 of file class.ilADTGroupDBBridge.php.

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

126  {
127  $element = $this->getElement((string) $field_id);
128  if (!$element) {
129  return;
130  }
131  $element->setPrimary(
132  array_merge(
133  $this->getPrimary(),
134  [
135  $field_name => [$field_type, $field_id]
136  ]
137  )
138  );
139  $element->setElementId((string) $field_id);
140  $element->afterUpdate();
141  }
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 60 of file class.ilADTGroupDBBridge.php.

References getElements(), and null.

Referenced by afterUpdateElement().

60  : ?ilADTDBBridge
61  {
62  if (array_key_exists($a_element_id, $this->getElements())) {
63  return $this->elements[$a_element_id];
64  }
65  return null;
66  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 54 of file class.ilADTGroupDBBridge.php.

References $elements, and prepareElements().

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

54  : array
55  {
56  $this->prepareElements();
57  return $this->elements;
58  }
+ 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 25 of file class.ilADTGroupDBBridge.php.

25  : bool
26  {
27  return ($a_adt instanceof ilADTGroup);
28  }

◆ prepareElements()

ilADTGroupDBBridge::prepareElements ( )
protected

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

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

Referenced by getElements().

32  : void
33  {
34  if (count($this->elements)) {
35  return;
36  }
37 
38  $this->elements = array();
39  $factory = ilADTFactory::getInstance();
40 
41  // convert ADTs to DB bridges
42 
43  foreach ($this->getADT()->getElements() as $name => $element) {
44  $this->elements[$name] = $factory->getDBBridgeForInstance($element);
45  $this->elements[$name]->setElementId((string) $name);
46  $this->elements[$name]->setTable($this->getTable());
47  $this->elements[$name]->setPrimary($this->getPrimary());
48  }
49  }
getPrimary()
Get primary fields.
+ 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 99 of file class.ilADTGroupDBBridge.php.

References getElements().

99  : void
100  {
101  foreach ($this->getElements() as $element) {
102  $element->prepareInsert($a_fields);
103  }
104  }
+ Here is the call graph for this function:

◆ readRecord()

ilADTGroupDBBridge::readRecord ( array  $a_row)

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

References getElements().

92  : void
93  {
94  foreach ($this->getElements() as $element) {
95  $element->readRecord($a_row);
96  }
97  }
+ Here is the call graph for this function:

◆ setPrimary()

ilADTGroupDBBridge::setPrimary ( array  $a_value)

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

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

79  : void
80  {
81  parent::setPrimary($a_value);
82 
83  if (count($this->elements)) {
84  foreach (array_keys($this->getADT()->getElements()) as $name) {
85  $this->elements[$name]->setPrimary($this->getPrimary());
86  }
87  }
88  }
getPrimary()
Get primary fields.
+ Here is the call graph for this function:

◆ setTable()

ilADTGroupDBBridge::setTable ( string  $a_table)

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

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

69  : void
70  {
71  parent::setTable($a_table);
72  if (count($this->elements)) {
73  foreach (array_keys($this->getADT()->getElements()) as $name) {
74  $this->elements[$name]->setTable($this->getTable());
75  }
76  }
77  }
+ Here is the call graph for this function:

Field Documentation

◆ $elements

array ilADTGroupDBBridge::$elements = []
protected

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

Referenced by getElements().


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