ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilADTDBBridge Class Reference

ADT DB bridge base class. More...

+ Inheritance diagram for ilADTDBBridge:
+ Collaboration diagram for ilADTDBBridge:

Public Member Functions

 __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)
 
 setADT (ilADT $a_adt)
 

Protected Attributes

ilADT $adt
 
string $table
 
string $id
 
array $primary = []
 
ilDBInterface $db
 

Detailed Description

ADT DB bridge base class.

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 25 of file class.ilADTDBBridge.php.

Constructor & Destructor Documentation

◆ __construct()

ilADTDBBridge::__construct ( ilADT  $a_adt)

Constructor.

Parameters
ilADT$a_adt

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

References $DIC, isValidADT(), and setADT().

39  {
40  global $DIC;
41 
42  $this->db = $DIC->database();
43  $this->setADT($a_adt);
44  }
setADT(ilADT $a_adt)
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ afterDelete()

ilADTDBBridge::afterDelete ( )

After delete hook to enable sub-tables.

Definition at line 160 of file class.ilADTDBBridge.php.

160  : void
161  {
162  }

◆ afterInsert()

ilADTDBBridge::afterInsert ( )

After insert hook to enable sub-tables.

Definition at line 141 of file class.ilADTDBBridge.php.

141  : void
142  {
143  }

◆ afterUpdate()

ilADTDBBridge::afterUpdate ( )

After update hook to enable sub-tables.

Definition at line 153 of file class.ilADTDBBridge.php.

153  : void
154  {
155  }

◆ buildPrimaryWhere()

ilADTDBBridge::buildPrimaryWhere ( )

Convert primary keys array to sql string.

Returns
string
See also
ilADTActiveRecord (:TODO: needed for multi)

Definition at line 117 of file class.ilADTDBBridge.php.

References prepareInsert(), and readRecord().

Referenced by ilADTMultiEnumDBBridge\deleteIndices(), ilADTLocalizedTextDBBridge\deleteTranslations(), and ilADTMultiDBBridge\readRecord().

117  : string
118  {
119  $sql = [];
120  foreach ($this->primary as $field => $def) {
121  $sql[] = $field . "=" . $this->db->quote($def[1], $def[0]);
122  }
123  return implode(" AND ", $sql);
124  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAdditionalPrimaryFields()

ilADTDBBridge::getAdditionalPrimaryFields ( )

Definition at line 98 of file class.ilADTDBBridge.php.

98  : array
99  {
100  return [];
101  }

◆ getADT()

ilADTDBBridge::getADT ( )

◆ getElementId()

◆ getPrimary()

ilADTDBBridge::getPrimary ( )

Get primary fields.

Returns
array

Definition at line 107 of file class.ilADTDBBridge.php.

References $primary.

Referenced by ilADTGroupDBBridge\afterUpdateElement(), ilADTMultiEnumDBBridge\insertIndices(), ilADTLocalizedTextDBBridge\insertTranslations(), ilADTGroupDBBridge\prepareElements(), and ilADTGroupDBBridge\setPrimary().

107  : array
108  {
109  return $this->primary;
110  }
+ Here is the caller graph for this function:

◆ getTable()

ilADTDBBridge::getTable ( )

Definition at line 66 of file class.ilADTDBBridge.php.

References $table.

Referenced by ilADTMultiDBBridge\getSubTableName(), ilADTGroupDBBridge\prepareElements(), and ilADTGroupDBBridge\setTable().

66  : ?string
67  {
68  return $this->table;
69  }
+ Here is the caller graph for this function:

◆ isValidADT()

ilADTDBBridge::isValidADT ( ilADT  $a_adt)
abstractprotected

Referenced by __construct(), and setADT().

+ Here is the caller graph for this function:

◆ prepareInsert()

ilADTDBBridge::prepareInsert ( array &  $a_fields)
abstract

Prepare ADT values for insert.

Parameters
array&$a_fields

Referenced by buildPrimaryWhere(), and prepareUpdate().

+ Here is the caller graph for this function:

◆ prepareUpdate()

ilADTDBBridge::prepareUpdate ( array &  $a_fields)

Definition at line 145 of file class.ilADTDBBridge.php.

References prepareInsert().

145  : void
146  {
147  $this->prepareInsert($a_fields);
148  }
prepareInsert(array &$a_fields)
Prepare ADT values for insert.
+ Here is the call graph for this function:

◆ readRecord()

ilADTDBBridge::readRecord ( array  $a_row)
abstract

Import DB values to ADT.

Parameters
array$a_row

Referenced by buildPrimaryWhere().

+ Here is the caller graph for this function:

◆ setADT()

ilADTDBBridge::setADT ( ilADT  $a_adt)
protected

Definition at line 48 of file class.ilADTDBBridge.php.

References isValidADT().

Referenced by __construct().

48  : void
49  {
50  if (!$this->isValidADT($a_adt)) {
51  throw new \InvalidArgumentException('ADTDBBridge Type mismatch.');
52  }
53  $this->adt = $a_adt;
54  }
isValidADT(ilADT $a_adt)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setElementId()

ilADTDBBridge::setElementId ( string  $a_value)

Set element id (aka DB column[s] [prefix])

Parameters
string$a_value

Definition at line 75 of file class.ilADTDBBridge.php.

75  : void
76  {
77  $this->id = $a_value;
78  }

◆ setPrimary()

ilADTDBBridge::setPrimary ( array  $a_value)

Set primary fields (in MDB2 format)

Parameters
array$a_value

Definition at line 93 of file class.ilADTDBBridge.php.

Referenced by ilADTTest\initDBBridge().

93  : void
94  {
95  $this->primary = $a_value;
96  }
+ Here is the caller graph for this function:

◆ setTable()

ilADTDBBridge::setTable ( string  $a_table)

Definition at line 61 of file class.ilADTDBBridge.php.

Referenced by ilADTTest\initDBBridge().

61  : void
62  {
63  $this->table = $a_table;
64  }
+ Here is the caller graph for this function:

◆ supportsDefaultValueColumn()

ilADTDBBridge::supportsDefaultValueColumn ( )

true if table storage relies on the default 'value' column

Returns
bool

Definition at line 168 of file class.ilADTDBBridge.php.

168  : bool
169  {
170  return true;
171  }

Field Documentation

◆ $adt

ilADT ilADTDBBridge::$adt
protected

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

Referenced by getADT().

◆ $db

ilDBInterface ilADTDBBridge::$db
protected

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

◆ $id

string ilADTDBBridge::$id
protected

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

Referenced by getElementId().

◆ $primary

array ilADTDBBridge::$primary = []
protected

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

Referenced by getPrimary().

◆ $table

string ilADTDBBridge::$table
protected

Definition at line 28 of file class.ilADTDBBridge.php.

Referenced by getTable().


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