ADT Active Record helper class This class expects a valid primary for all actions!
More...
ADT Active Record helper class This class expects a valid primary for all actions!
- 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 12 of file class.ilADTActiveRecord.php.
◆ __construct()
Constructor.
- Parameters
-
Definition at line 22 of file class.ilADTActiveRecord.php.
References $DIC.
26 $this->db = $DIC->database();
27 $this->properties = $a_properties;
◆ create()
ilADTActiveRecord::create |
( |
| ) |
|
Definition at line 50 of file class.ilADTActiveRecord.php.
52 $fields = $this->properties->getPrimary();
53 $this->properties->prepareInsert($fields);
54 $this->db->insert($this->properties->getTable(), $fields);
55 $this->properties->afterInsert();
◆ delete()
ilADTActiveRecord::delete |
( |
| ) |
|
Definition at line 66 of file class.ilADTActiveRecord.php.
68 $this->db->manipulate(
"DELETE FROM " . $this->properties->getTable() .
69 " WHERE " . $this->properties->buildPrimaryWhere());
70 $this->properties->afterDelete();
◆ read()
ilADTActiveRecord::read |
( |
| ) |
|
Read record.
- Returns
- bool
Definition at line 34 of file class.ilADTActiveRecord.php.
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);
◆ update()
ilADTActiveRecord::update |
( |
| ) |
|
Definition at line 58 of file class.ilADTActiveRecord.php.
61 $this->properties->prepareUpdate($fields);
62 $this->db->update($this->properties->getTable(), $fields, $this->properties->getPrimary());
63 $this->properties->afterUpdate();
◆ $db
◆ $properties
The documentation for this class was generated from the following file: