public function save(Doctrine_Connection $conn = null)
 {
     if ($this->isNew() && !$this->getExpiresAt()) {
         $now = $this->getCreatedAt() ? $this->getDateTimeObject('created_at')->format('U') : time();
         $this->setExpiresAt(date('Y-m-d H:i:s', $now + 86400 * sfConfig::get('app_active_days')));
     }
     return parent::save($conn);
 }
Ejemplo n.º 2
0
 public function save(Doctrine_Connection $conn = null)
 {
     if ($this->isNew() && !$this->getExpiresAt()) {
         $now = $this->getCreatedAt() ? strtotime($this->getCreatedAt()) : time();
         $this->setExpiresAt(date('Y-m-d h:i:s', $now + 86400 * sfConfig::get('app_active_days')));
     }
     return parent::save($conn);
 }
 public function save(Doctrine_Connection $conn = null)
 {
     //Si el objeto se está por serialzar por primera vez, y no se especificó la fecha de caducidad...
     if ($this->isNew() && !$this->getExpiresAt()) {
         //Si existe la fecha de creación, la utilizamos. De lo contrario utilizamos el tiempo actual
         $timeNow = $this->getCreatedAt() ? strtotime('', $this->getCreatedAt()) : time();
         $this->setExpiresAt(date('Y-m-d h:i:s', $timeNow + 60 * 60 * 24 * sfConfig::get('app_active_days')));
         //( segundos * minutos * horas ) * dias
     }
     return parent::save($conn);
 }
Ejemplo n.º 4
0
 public function save(PropelPDO $con = null)
 {
     if ($this->isNew() && !$this->getExpiresAt()) {
         $now = $this->getCreatedAt() ? $this->getCreatedAt('U') : time();
         $this->setExpiresAt($now + 86400 * sfConfig::get('app_active_days'));
     }
     if (!$this->getToken()) {
         $this->setToken(sha1($this->getEmail() . rand(11111, 99999)));
     }
     return parent::save($con);
 }
Ejemplo n.º 5
0
 public function save(Doctrine_Connection $conn = null)
 {
     if ($this->isNew() && !$this->getExpiresAt()) {
         $now = $this->getCreatedAt() ? $this->getDateTimeObject('created_at')->format('U') : time();
         $this->setExpiresAt(date('Y-m-d H:i:s', $now + 86400 * sfConfig::get('app_active_days')));
     }
     if (!$this->getToken()) {
         $this->setToken(sha1($this->getEmail() . rand(11111, 99999)));
     }
     $conn = $conn ? $conn : $this->getTable()->getConnection();
     $conn->beginTransaction();
     try {
         $ret = parent::save($conn);
         $this->updateLuceneIndex();
         $conn->commit();
         return $ret;
     } catch (Exception $e) {
         $conn->rollBack();
         throw $e;
     }
 }