3 declare(strict_types=1);
26 $this->db = $DIC->database();
27 $this->properties = $a_properties;
34 public function read(): bool
37 $this->properties->getADT()->reset();
39 $sql =
"SELECT * FROM " . $this->properties->getTable() .
40 " WHERE " . $this->properties->buildPrimaryWhere();
41 $set = $this->db->query($sql);
42 if ($this->db->numRows($set)) {
43 $row = $this->db->fetchAssoc($set);
44 $this->properties->readRecord($row);
52 $fields = $this->properties->getPrimary();
53 $this->properties->prepareInsert($fields);
54 $this->db->insert($this->properties->getTable(), $fields);
55 $this->properties->afterInsert();
61 $this->properties->prepareUpdate($fields);
62 $this->db->update($this->properties->getTable(), $fields, $this->properties->getPrimary());
63 $this->properties->afterUpdate();
66 public function delete():
void 68 $this->db->manipulate(
"DELETE FROM " . $this->properties->getTable() .
69 " WHERE " . $this->properties->buildPrimaryWhere());
70 $this->properties->afterDelete();
ilADTGroupDBBridge $properties
ADT Active Record helper class This class expects a valid primary for all actions! ...
__construct(ilADTGroupDBBridge $a_properties)
Constructor.