ILIAS  trunk Revision v5.2.0beta1-34132-g2d4d73d4a0
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 11 of file class.ilADTDBBridge.php.

Constructor & Destructor Documentation

◆ __construct()

ilADTDBBridge::__construct ( ilADT  $a_adt)

Constructor.

Parameters
ilADT$a_adt

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

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

25  {
26  global $DIC;
27 
28  $this->db = $DIC->database();
29  $this->setADT($a_adt);
30  }
setADT(ilADT $a_adt)
$DIC
Definition: xapitoken.php:62
+ Here is the call graph for this function:

Member Function Documentation

◆ afterDelete()

ilADTDBBridge::afterDelete ( )

After delete hook to enable sub-tables.

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

146  : void
147  {
148  }

◆ afterInsert()

ilADTDBBridge::afterInsert ( )

After insert hook to enable sub-tables.

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

127  : void
128  {
129  }

◆ afterUpdate()

ilADTDBBridge::afterUpdate ( )

After update hook to enable sub-tables.

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

139  : void
140  {
141  }

◆ buildPrimaryWhere()

ilADTDBBridge::buildPrimaryWhere ( )

Convert primary keys array to sql string.

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

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

References prepareInsert(), and readRecord().

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

103  : string
104  {
105  $sql = [];
106  foreach ($this->primary as $field => $def) {
107  $sql[] = $field . "=" . $this->db->quote($def[1], $def[0]);
108  }
109  return implode(" AND ", $sql);
110  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAdditionalPrimaryFields()

ilADTDBBridge::getAdditionalPrimaryFields ( )

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

84  : array
85  {
86  return [];
87  }

◆ getADT()

ilADTDBBridge::getADT ( )

◆ getElementId()

◆ getPrimary()

ilADTDBBridge::getPrimary ( )

Get primary fields.

Returns
array

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

References $primary.

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

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

◆ getTable()

ilADTDBBridge::getTable ( )

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

References $table.

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

52  : ?string
53  {
54  return $this->table;
55  }
+ 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 131 of file class.ilADTDBBridge.php.

References prepareInsert().

131  : void
132  {
133  $this->prepareInsert($a_fields);
134  }
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 34 of file class.ilADTDBBridge.php.

References isValidADT().

Referenced by __construct().

34  : void
35  {
36  if (!$this->isValidADT($a_adt)) {
37  throw new \InvalidArgumentException('ADTDBBridge Type mismatch.');
38  }
39  $this->adt = $a_adt;
40  }
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 61 of file class.ilADTDBBridge.php.

61  : void
62  {
63  $this->id = $a_value;
64  }

◆ setPrimary()

ilADTDBBridge::setPrimary ( array  $a_value)

Set primary fields (in MDB2 format)

Parameters
array$a_value

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

Referenced by ilADTTest\initDBBridge().

79  : void
80  {
81  $this->primary = $a_value;
82  }
+ Here is the caller graph for this function:

◆ setTable()

ilADTDBBridge::setTable ( string  $a_table)

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

Referenced by ilADTTest\initDBBridge().

47  : void
48  {
49  $this->table = $a_table;
50  }
+ 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 154 of file class.ilADTDBBridge.php.

154  : bool
155  {
156  return true;
157  }

Field Documentation

◆ $adt

ilADT ilADTDBBridge::$adt
protected

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

Referenced by getADT().

◆ $db

ilDBInterface ilADTDBBridge::$db
protected

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

◆ $id

string ilADTDBBridge::$id
protected

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

Referenced by getElementId().

◆ $primary

array ilADTDBBridge::$primary = []
protected

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

Referenced by getPrimary().

◆ $table

string ilADTDBBridge::$table
protected

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

Referenced by getTable().


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