/** * Overload the update method to auto-insert * the timestamp for modified if not exist * * @return void * @author Sam de Freyssinet */ public function update() { if (!isset($this->_fields['modified'])) { return parent::update(); } if ($this->modified === NULL) { $this->modified = time(); } return parent::update(); }
protected function __construct() { // Set the $_db to the static $_usedb // The static $_usedb thus determines which db future Sprig instances will have // Example: Sprig_Wi3::$_usedb = Database::instance("name", $config); $obj = Sprig_Wi3::factory(""); ... more Sprig_Wi3 models if (!empty(self::$_usedb)) { $this->_db = self::$_usedb; } // Now construct the Sprig return parent::__construct(); }