ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilADTGroupDBBridge Class Reference
+ Inheritance diagram for ilADTGroupDBBridge:
+ Collaboration diagram for ilADTGroupDBBridge:

Public Member Functions

 getElements ()
 
 getElement ($a_element_id)
 
 setTable ($a_table)
 Set table name. More...
 
 setPrimary (array $a_value)
 Set primary fields (in MDB2 format) 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...
 
 afterUpdate ()
 After update hook to enable sub-tables. More...
 
 afterDelete ()
 After delete hook to enable sub-tables. More...
 
- Public Member Functions inherited from ilADTDBBridge
 __construct (ilADT $a_adt)
 Constructor. More...
 
 getADT ()
 Get ADT. More...
 
 setTable ($a_table)
 Set table name. More...
 
 getTable ()
 Get table name. More...
 
 setElementId ($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...
 
 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)
 Prepare ADT values for update. More...
 
 afterUpdate ()
 After update hook to enable sub-tables. More...
 
 afterDelete ()
 After delete hook to enable sub-tables. More...
 

Protected Member Functions

 isValidADT (ilADT $a_adt)
 Check if given ADT is valid. More...
 
 prepareElements ()
 
- Protected Member Functions inherited from ilADTDBBridge
 isValidADT (ilADT $a_adt)
 Check if given ADT is valid. More...
 
 setADT (ilADT $a_adt)
 Set ADT. More...
 

Protected Attributes

 $elements
 
- Protected Attributes inherited from ilADTDBBridge
 $adt
 
 $table
 
 $id
 
 $primary
 

Detailed Description

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

Member Function Documentation

◆ afterDelete()

ilADTGroupDBBridge::afterDelete ( )

After delete hook to enable sub-tables.

Reimplemented from ilADTDBBridge.

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

117 {
118 foreach($this->getElements() as $element)
119 {
120 $element->afterDelete();
121 }
122 }

References getElements().

+ Here is the call graph for this function:

◆ afterInsert()

ilADTGroupDBBridge::afterInsert ( )

After insert hook to enable sub-tables.

Reimplemented from ilADTDBBridge.

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

101 {
102 foreach($this->getElements() as $element)
103 {
104 $element->afterInsert();
105 }
106 }

References getElements().

+ Here is the call graph for this function:

◆ afterUpdate()

ilADTGroupDBBridge::afterUpdate ( )

After update hook to enable sub-tables.

Reimplemented from ilADTDBBridge.

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

109 {
110 foreach($this->getElements() as $element)
111 {
112 $element->afterUpdate();
113 }
114 }

References getElements().

+ Here is the call graph for this function:

◆ getElement()

ilADTGroupDBBridge::getElement (   $a_element_id)

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

45 {
46 if(array_key_exists($a_element_id, $this->getElements()))
47 {
48 return $this->elements[$a_element_id];
49 }
50 }

References getElements().

+ Here is the call graph for this function:

◆ getElements()

ilADTGroupDBBridge::getElements ( )

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

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

◆ isValidADT()

ilADTGroupDBBridge::isValidADT ( ilADT  $a_adt)
protected

Check if given ADT is valid.

:TODO: This could be avoided with type-specifc constructors :TODO: bridge base class?

Parameters
ilADT$a_adt

Reimplemented from ilADTDBBridge.

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

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

◆ prepareElements()

ilADTGroupDBBridge::prepareElements ( )
protected

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

18 {
19 if(sizeof($this->elements))
20 {
21 return;
22 }
23
24 $this->elements = array();
25 $factory = ilADTFactory::getInstance();
26
27 // convert ADTs to DB bridges
28
29 foreach($this->getADT()->getElements() as $name => $element)
30 {
31 $this->elements[$name] = $factory->getDBBridgeForInstance($element);
32 $this->elements[$name]->setElementId($name);
33 $this->elements[$name]->setTable($this->getTable());
34 $this->elements[$name]->setPrimary($this->getPrimary());
35 }
36 }
getPrimary()
Get primary fields.
getTable()
Get table name.
static getInstance()
Get singleton.

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

Referenced by getElements().

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

◆ prepareInsert()

ilADTGroupDBBridge::prepareInsert ( array &  $a_fields)

Prepare ADT values for insert.

Parameters
array&$a_fields

Reimplemented from ilADTDBBridge.

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

93 {
94 foreach($this->getElements() as $element)
95 {
96 $element->prepareInsert($a_fields);
97 }
98 }

References getElements().

+ Here is the call graph for this function:

◆ readRecord()

ilADTGroupDBBridge::readRecord ( array  $a_row)

Import DB values to ADT.

Parameters
array$a_row

Reimplemented from ilADTDBBridge.

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

85 {
86 foreach($this->getElements() as $element)
87 {
88 $element->readRecord($a_row);
89 }
90 }

References getElements().

+ Here is the call graph for this function:

◆ setPrimary()

ilADTGroupDBBridge::setPrimary ( array  $a_value)

Set primary fields (in MDB2 format)

Parameters
array$a_value

Reimplemented from ilADTDBBridge.

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

69 {
70 parent::setPrimary($a_value);
71
72 if(sizeof($this->elements))
73 {
74 foreach(array_keys($this->getADT()->getElements()) as $name)
75 {
76 $this->elements[$name]->setPrimary($this->getPrimary());
77 }
78 }
79 }

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

Referenced by ilADTTest\initDBBridge().

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

◆ setTable()

ilADTGroupDBBridge::setTable (   $a_table)

Set table name.

Parameters
string$a_table

Reimplemented from ilADTDBBridge.

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

56 {
57 parent::setTable($a_table);
58
59 if(sizeof($this->elements))
60 {
61 foreach(array_keys($this->getADT()->getElements()) as $name)
62 {
63 $this->elements[$name]->setTable($this->getTable());
64 }
65 }
66 }

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

Referenced by ilADTTest\initDBBridge().

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

Field Documentation

◆ $elements

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: