Beispiel #1
0
 /**
  * Processing object before save data
  * Add created_at  and modified_at params
  *
  * @return Mage_XmlConnect_Model_Template
  */
 protected function _beforeSave()
 {
     parent::_beforeSave();
     $currentDate = Mage::getSingleton('core/date')->gmtDate();
     if (!$this->getId()) {
         $this->setCreatedAt($currentDate);
     }
     $this->setModifiedAt($currentDate);
     return $this;
 }
Beispiel #2
0
 /**
  * Save object data
  *
  * @return Mage_Core_Model_Abstract
  */
 public function save()
 {
     if (!$this->getIsSent() && $this->getStatus() == self::STATUS_IN_QUEUE) {
         try {
             Mage::dispatchEvent('before_save_message_queue', array('queueMessage' => $this));
         } catch (Exception $e) {
             Mage::logException($e);
         }
     }
     return parent::save();
 }
Beispiel #3
0
 /**
  * Processing object before save data
  *
  * @return Mage_Newsletter_Model_Template
  */
 protected function _beforeSave()
 {
     $this->validate();
     return parent::_beforeSave();
 }
Beispiel #4
0
 /**
  * Validate email template code
  *
  * @return Mage_Core_Model_Email_Template
  */
 protected function _beforeSave()
 {
     $code = $this->getTemplateCode();
     if (empty($code)) {
         Mage::throwException(Mage::helper('core')->__('The template Name must not be empty.'));
     }
     if ($this->_getResource()->checkCodeUsage($this)) {
         Mage::throwException(Mage::helper('core')->__('Duplicate Of Template Name'));
     }
     return parent::_beforeSave();
 }
Beispiel #5
0
 /**
  * Initialize resource model
  */
 protected function _construct()
 {
     parent::_construct();
     $emailTemplate = $this->_getData('email_template');
     if ($emailTemplate) {
         $this->unsetData('email_template');
         if (!$emailTemplate instanceof Mage_Core_Model_Email_Template) {
             throw new Exception('Instance of Mage_Core_Model_Email_Template is expected.');
         }
         $this->_emailTemplate = $emailTemplate;
     }
     $this->_init('Mage_Newsletter_Model_Resource_Queue');
 }
Beispiel #6
0
 public function testSetDesignConfigWithValidInputParametersReturnsSuccess()
 {
     $config = array('area' => 'some_area', 'store' => 1);
     $this->_model->setDesignConfig($config);
     $this->assertEquals($config, $this->_model->getDesignConfig()->getData());
 }