ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilADTDateTimeDBBridge.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 protected function isValidADT(ilADT $a_adt): bool
24 {
25 return ($a_adt instanceof ilADTDateTime);
26 }
27
28 // CRUD
29
30 public function readRecord(array $a_row): void
31 {
32 $date = null;
33 if ($a_row[$this->getElementId()]) {
34 $date = new ilDateTime($a_row[$this->getElementId()], IL_CAL_DATETIME);
35 }
36 $this->getADT()->setDate($date);
37 }
38
39 public function prepareInsert(array &$a_fields): void
40 {
41 $date = $this->getADT()->getDate();
42 if ($date instanceof ilDateTime) {
43 $date = $date->get(IL_CAL_DATETIME);
44 }
45 $a_fields[$this->getElementId()] = array("timestamp", $date);
46 }
47}
const IL_CAL_DATETIME
ADT DB bridge base class.
getElementId()
Get element id.
prepareInsert(array &$a_fields)
Prepare ADT values for insert.
readRecord(array $a_row)
Import DB values to ADT.
ADT base class.
Definition: class.ilADT.php:26
@classDescription Date and time handling