Пример #1
0
 protected function _beforeSave()
 {
     parent::_beforeSave();
     if ($this->_mediumData) {
         $this->setData('medium_json', $this->_mediumData->toJson());
     }
     if ($this->_provider) {
         $this->setProvider($this->_provider->getType());
         $this->setFilterData($this->_provider->getFilter()->asJson());
     }
     if (!$this->getData('medium')) {
         throw new Exception("Campaign must define a medium");
     }
     if (!$this->getData('provider')) {
         throw new Exception("Campaign must define a recipient provider");
     }
 }