ILIAS  release_7 Revision v7.30-3-g800a261c036
ilADTMultiEnumDBBridge Class Reference
+ Inheritance diagram for ilADTMultiEnumDBBridge:
+ Collaboration diagram for ilADTMultiEnumDBBridge:

Public Member Functions

 __construct (ilADT $a_adt)
 Constructor. More...
 
 getTable ()
 Get table name. More...
 
 setFakeSingle ($a_status)
 
 readRecord (array $a_row)
 Import DB values to ADT. More...
 
 afterInsert ()
 After insert hook to enable sub-tables. More...
 
 afterUpdate ()
 After update hook to enable sub-tables. More...
 
 prepareInsert (array &$a_fields)
 Prepare ADT values for insert. More...
 
 supportsDefaultValueColumn ()
 true if table storage relies on the default 'value' column 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...
 
 supportsDefaultValueColumn ()
 true if table storage relies on the default 'value' column More...
 

Data Fields

const TABLE_NAME = 'adv_md_values_enum'
 
const SEPARATOR = "~|~"
 

Protected Member Functions

 isValidADT (ilADT $a_adt)
 Check if given ADT is valid. More...
 
 doSingleFake ()
 
 deleteIndices ()
 
 insertIndices ()
 
- 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

 $db
 
 $fake_single
 
- Protected Attributes inherited from ilADTDBBridge
 $adt
 
 $table
 
 $id
 
 $primary = []
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilADTMultiEnumDBBridge::__construct ( ilADT  $a_adt)

Constructor.

Parameters
ilADT$a_adt
Returns
self

Reimplemented from ilADTDBBridge.

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

19 {
20 global $DIC;
21
22 $this->db = $DIC->database();
23 parent::__construct($a_adt);
24 }
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ afterInsert()

ilADTMultiEnumDBBridge::afterInsert ( )

After insert hook to enable sub-tables.

Reimplemented from ilADTDBBridge.

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

54 {
55 return $this->afterUpdate();
56 }
afterUpdate()
After update hook to enable sub-tables.

References afterUpdate().

+ Here is the call graph for this function:

◆ afterUpdate()

ilADTMultiEnumDBBridge::afterUpdate ( )

After update hook to enable sub-tables.

Reimplemented from ilADTDBBridge.

Definition at line 58 of file class.ilADTMultiEnumDBBridge.php.

References deleteIndices(), and insertIndices().

Referenced by afterInsert().

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

◆ deleteIndices()

ilADTMultiEnumDBBridge::deleteIndices ( )
protected

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

70 {
71 $this->db->query(
72 'delete from ' . $this->getTable() . ' ' .
73 'where ' . $this->buildPrimaryWhere()
74 );
75 }
buildPrimaryWhere()
Convert primary keys array to sql string.

References ilADTDBBridge\buildPrimaryWhere(), and getTable().

Referenced by afterUpdate().

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

◆ doSingleFake()

ilADTMultiEnumDBBridge::doSingleFake ( )
protected

Definition at line 41 of file class.ilADTMultiEnumDBBridge.php.

References $fake_single.

◆ getTable()

ilADTMultiEnumDBBridge::getTable ( )

Get table name.

Returns
string

Reimplemented from ilADTDBBridge.

Definition at line 26 of file class.ilADTMultiEnumDBBridge.php.

26 : string
27 {
28 return self::TABLE_NAME;
29 }

References TABLE_NAME.

Referenced by deleteIndices(), and insertIndices().

+ Here is the caller graph for this function:

◆ insertIndices()

ilADTMultiEnumDBBridge::insertIndices ( )
protected

Definition at line 77 of file class.ilADTMultiEnumDBBridge.php.

78 {
79 foreach ($this->getADT()->getSelections() as $index)
80 {
81 $fields = $this->getPrimary();
82 $fields['value_index'] = [ilDBConstants::T_INTEGER, $index];
83 $num_row = $this->db->insert($this->getTable(), $fields);
84 ilLoggerFactory::getLogger('amet')->dump($num_row);
85 }
86 }
getPrimary()
Get primary fields.
static getLogger($a_component_id)
Get component logger.
$index
Definition: metadata.php:128

References $index, ilADTDBBridge\getADT(), ilLoggerFactory\getLogger(), ilADTDBBridge\getPrimary(), getTable(), and ilDBConstants\T_INTEGER.

Referenced by afterUpdate().

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

◆ isValidADT()

ilADTMultiEnumDBBridge::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 31 of file class.ilADTMultiEnumDBBridge.php.

32 {
33 return ($a_adt instanceof ilADTMultiEnum);
34 }

◆ prepareInsert()

ilADTMultiEnumDBBridge::prepareInsert ( array &  $a_fields)

Prepare ADT values for insert.

Parameters
array&$a_fields

Reimplemented from ilADTDBBridge.

Definition at line 64 of file class.ilADTMultiEnumDBBridge.php.

65 {
66 $a_fields = [];
67 }

◆ readRecord()

ilADTMultiEnumDBBridge::readRecord ( array  $a_row)

Import DB values to ADT.

Parameters
array$a_row

Reimplemented from ilADTDBBridge.

Definition at line 46 of file class.ilADTMultiEnumDBBridge.php.

47 {
48 if (isset($a_row[$this->getElementId()])) {
49 $this->getADT()->addSelection($a_row[$this->getElementId()]);
50 }
51 }
getElementId()
Get element id.

References ilADTDBBridge\getADT(), and ilADTDBBridge\getElementId().

+ Here is the call graph for this function:

◆ setFakeSingle()

ilADTMultiEnumDBBridge::setFakeSingle (   $a_status)

Definition at line 36 of file class.ilADTMultiEnumDBBridge.php.

37 {
38 $this->fake_single = (bool) $a_status;
39 }

◆ supportsDefaultValueColumn()

ilADTMultiEnumDBBridge::supportsDefaultValueColumn ( )

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

Returns
bool

Reimplemented from ilADTDBBridge.

Definition at line 88 of file class.ilADTMultiEnumDBBridge.php.

88 : bool
89 {
90 return false;
91 }

Field Documentation

◆ $db

ilADTMultiEnumDBBridge::$db
protected

Definition at line 12 of file class.ilADTMultiEnumDBBridge.php.

◆ $fake_single

ilADTMultiEnumDBBridge::$fake_single
protected

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

Referenced by doSingleFake().

◆ SEPARATOR

const ilADTMultiEnumDBBridge::SEPARATOR = "~|~"

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

◆ TABLE_NAME

const ilADTMultiEnumDBBridge::TABLE_NAME = 'adv_md_values_enum'

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

Referenced by getTable().


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