Exemplo n.º 1
0
 public function _beforeSave()
 {
     parent::_beforeSave();
     $this->setData('name', strtolower($this->getData('name')));
 }
Exemplo n.º 2
0
 protected function _beforeSave()
 {
     parent::_beforeSave();
     if (!$this->getData('activity_id')) {
         throw new Exception('Activity is empty');
     }
     //        if(!$this->getData('city_id')){
     //          throw new Exception('City is empty');
     //        }
     if (!$this->getData('user_id')) {
         if ($this->getData('imei')) {
             $user_id = $this->_getUserByImei($this->getData('imei'));
             $this->setData('user_id', $user_id);
         } else {
             throw new Exception('User is empty');
         }
     }
     if (!$this->getData('date')) {
         throw new Exception('Date is empty');
     }
     if (!$this->getData('lat')) {
         throw new Exception('Lat is empty');
     }
     if (!$this->getData('long')) {
         throw new Exception('Long is empty');
     }
     $this->_applyUserColor()->_validDate();
     return $this;
 }