示例#1
0
 protected function beforeInsert()
 {
     if (empty($this->_data['created'])) {
         $this->_data['created'] = date('Y-m-d H:i:s', cot::$sys['now']);
     }
     return parent::beforeInsert();
 }
示例#2
0
 protected function beforeInsert()
 {
     // Удаление старых неподтвержденных подписчиков
     // Update пока не трогаем
     $this->garbageCollect();
     if (empty($this->_data['ip'])) {
         $this->_data['ip'] = cot::$usr['ip'];
     }
     if (empty($this->_data['created'])) {
         $this->_data['created'] = date('Y-m-d H:i:s', cot::$sys['now']);
     }
     if (empty($this->_data['created_by'])) {
         $this->_data['created_by'] = cot::$usr['id'];
     }
     if (empty($this->_data['updated'])) {
         $this->_data['updated'] = date('Y-m-d H:i:s', cot::$sys['now']);
     }
     if (empty($this->_data['updated_by'])) {
         $this->_data['updated_by'] = cot::$usr['id'];
     }
     // Код для отписки
     if (empty($this->_data['unsubscr_code'])) {
         $this->_data['unsubscr_code'] = static::generateUnsubscribeCode();
     }
     return parent::beforeInsert();
 }