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 26 of file class.ilADTActiveRecord.php.
◆ __construct()
Constructor.
- Parameters
-
Definition at line 36 of file class.ilADTActiveRecord.php.
References $DIC.
40 $this->db = $DIC->database();
41 $this->properties = $a_properties;
◆ create()
ilADTActiveRecord::create |
( |
| ) |
|
Definition at line 64 of file class.ilADTActiveRecord.php.
66 $fields = $this->properties->getPrimary();
67 $this->properties->prepareInsert($fields);
68 $this->db->insert($this->properties->getTable(), $fields);
69 $this->properties->afterInsert();
◆ delete()
ilADTActiveRecord::delete |
( |
| ) |
|
Definition at line 80 of file class.ilADTActiveRecord.php.
82 $this->db->manipulate(
"DELETE FROM " . $this->properties->getTable() .
83 " WHERE " . $this->properties->buildPrimaryWhere());
84 $this->properties->afterDelete();
◆ read()
ilADTActiveRecord::read |
( |
| ) |
|
Read record.
- Returns
- bool
Definition at line 48 of file class.ilADTActiveRecord.php.
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);
◆ update()
ilADTActiveRecord::update |
( |
| ) |
|
Definition at line 72 of file class.ilADTActiveRecord.php.
75 $this->properties->prepareUpdate($fields);
76 $this->db->update($this->properties->getTable(), $fields, $this->properties->getPrimary());
77 $this->properties->afterUpdate();
◆ $db
◆ $properties
The documentation for this class was generated from the following file: