19 declare(strict_types=1);
40 $this->db = $DIC->database();
41 $this->properties = $a_properties;
48 public function read(): bool
51 $this->properties->getADT()->reset();
53 $sql =
"SELECT * FROM " . $this->properties->getTable() .
54 " WHERE " . $this->properties->buildPrimaryWhere();
55 $set = $this->db->query($sql);
56 if ($this->db->numRows($set)) {
57 $row = $this->db->fetchAssoc($set);
58 $this->properties->readRecord($row);
66 $fields = $this->properties->getPrimary();
67 $this->properties->prepareInsert($fields);
68 $this->db->insert($this->properties->getTable(), $fields);
69 $this->properties->afterInsert();
75 $this->properties->prepareUpdate($fields);
76 $this->db->update($this->properties->getTable(), $fields, $this->properties->getPrimary());
77 $this->properties->afterUpdate();
80 public function delete():
void 82 $this->db->manipulate(
"DELETE FROM " . $this->properties->getTable() .
83 " WHERE " . $this->properties->buildPrimaryWhere());
84 $this->properties->afterDelete();
ilADTGroupDBBridge $properties
ADT Active Record helper class This class expects a valid primary for all actions! ...
__construct(ilADTGroupDBBridge $a_properties)
Constructor.