public function send($tm, $to, $from, $subject, $body, $headers) { if (!$this->model) { throw $this->exception('Must use setModel() on DBStore Transport'); } $data = array('to' => $to, 'from' => $from, 'subject' => $subject, 'body' => $body, 'headers' => $headers); $this->model->unload()->set($data)->save(); return $this; }
/** * Destroys this model (removes it and all references to it) */ public function destroy() { if ($this->getId() > 0) { if (method_exists($this, '__destroy')) { call_user_func(array($this, '__destroy')); } if ($table = Model::getTable($this)) { self::getDB($this)->execute("DELETE FROM `{$table}` WHERE id = %d", $this->getId()); } } Model::unload($this); }
/** forget currently loaded record and it's ID. Will not affect database */ function unload() { $this->hook('beforeUnload'); $this->id = null; parent::unload(); $this->hook('afterUnload'); return $this; }
/** * This is a temporary method to avoid code duplication, but insert / import should * be implemented differently. * * @param Model $m * @param array $row */ protected function _rawInsert($m, $row) { $m->reload_after_save = false; $m->unload(); $m->save($row); $m->data[$m->id_field] = $m->id; }
/** forget currently loaded record and it's ID. Will not affect database */ function unload() { if ($this->_save_later) { $this->_save_later = false; $this->saveAndUnload(); } $this->hook('beforeUnload'); $this->id = null; parent::unload(); $this->hook('afterUnload'); return $this; }