コード例 #1
0
 /**
  * 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;
 }
コード例 #2
0
 /**
  * @return boolean Success / Failure.
  */
 public function preSave()
 {
     if ($this->expiry === null) {
         $this->setExpiry('now +15 minutes');
     }
     return parent::preSave();
 }
コード例 #3
0
 /**
  * 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;
 }
コード例 #4
0
 /**
  * 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;
 }
コード例 #5
0
 /**
  * Hook called before saving the item.
  *
  * @return boolean
  * @see \Charcoal\Email\Queue\QueueItemTrait::preSaveQueueItem()
  */
 public function preSave()
 {
     parent::preSave();
     $this->preSaveQueueItem();
     return true;
 }
コード例 #6
0
 /**
  * @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;
 }
コード例 #7
0
 /**
  * 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();
 }