/** * 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; }
/** * 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(); }
/** * Processing object before save data * * @return Mage_Newsletter_Model_Template */ protected function _beforeSave() { $this->validate(); return parent::_beforeSave(); }
/** * 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(); }
/** * 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'); }
public function testSetDesignConfigWithValidInputParametersReturnsSuccess() { $config = array('area' => 'some_area', 'store' => 1); $this->_model->setDesignConfig($config); $this->assertEquals($config, $this->_model->getDesignConfig()->getData()); }