/** * Event called before _creating_ the object. * * @see Charcoal\Source\StorableTrait::preSave() For the "create" Event. * @return boolean */ public function preSave() { $result = parent::preSave(); $this->setTs('now'); if (getenv('REMOTE_ADDR')) { $this->setIp(getenv('REMOTE_ADDR')); } if (!isset($this->origin)) { $this->setOrigin($this->resolveOrigin()); } return $result; }
/** * @return boolean Success / Failure. */ public function preSave() { if ($this->expiry === null) { $this->setExpiry('now +15 minutes'); } return parent::preSave(); }
/** * StorableTrait > preSave(): Called automatically before saving the object to source. * @return boolean */ public function preSave() { parent::preSave(); if (password_needs_rehash($this->token, PASSWORD_DEFAULT)) { $this->token = password_hash($this->token, PASSWORD_DEFAULT); } $this->setCreated('now'); $this->setLastModified('now'); return true; }
/** * Hook called before saving the item. * * Presets the item as _to-be_ processed and queued now. * * @return QueueItemInterface Chainable */ public function preSave() { parent::preSave(); $this->setProcessed(false); return true; }
/** * Hook called before saving the item. * * @return boolean * @see \Charcoal\Email\Queue\QueueItemTrait::preSaveQueueItem() */ public function preSave() { parent::preSave(); $this->preSaveQueueItem(); return true; }
/** * @see StorableTrait::preSave() * @return boolean */ public function preSave() { parent::preSave(); $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''; $sessionId = session_id(); $this->setIp($ip); $this->setSessionId($sessionId); return true; }
/** * Event called before _creating_ the object. * * @see Charcoal\Source\StorableTrait::preSave() For the "create" Event. * @return boolean */ public function preSave() { $this->generateUniqueSlug(); $this->setCreationDate('now'); $this->setLastModificationDate('now'); return parent::preSave(); }