/**
  * @return boolean Success / Failure.
  */
 public function preSave()
 {
     if ($this->expiry === null) {
         $this->setExpiry('now +15 minutes');
     }
     return parent::preSave();
 }
Exemplo n.º 2
0
 /**
  * StorableTrait > preUpdate(): Called automatically before updating the object to source.
  * @param array $properties The properties (ident) set for update.
  * @return boolean
  */
 public function preUpdate(array $properties = null)
 {
     parent::preUpdate($properties);
     $this->setLastModified('now');
     return true;
 }
Exemplo n.º 3
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;
 }
 /**
  * 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;
 }
 /**
  * Dependencies
  * @param Container $container DI Container.
  * @return void
  */
 public function setDependencies(Container $container)
 {
     parent::setDependencies($container);
     $this->setModelFactory($container['model/factory']);
 }
Exemplo n.º 7
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;
 }
Exemplo n.º 8
0
 /**
  * Event called before _updating_ the object.
  *
  * @see    Charcoal\Source\StorableTrait::preUpdate() For the "update" Event.
  * @param  array $properties Optional. The list of properties to update.
  * @return boolean
  */
 public function preUpdate(array $properties = null)
 {
     $this->setCreationDate('now');
     $this->setLastModificationDate('now');
     return parent::preUpdate($properties);
 }