protected function _afterLoad() { if (is_string($this->getData('scope'))) { $this->setData('scope', @explode(',', $this->getData('scope'))); } return parent::_afterLoad(); }
protected function _afterLoad() { if (!is_array($this->getData('attachments'))) { $this->setData('attachments', @unserialize($this->getData('attachments'))); } return parent::_afterLoad(); }
/** * Prepares for save * @return */ protected function _beforeSave() { if (!$this->getId()) { $this->getQuote()->setUpdatedAt(now())->save(); $this->setIsNew(true); } if (is_null($this->getStoreId())) { $storeId = Mage::getSingleton('adminhtml/session_quote')->getStoreId() ? Mage::getSingleton('adminhtml/session_quote')->getStoreId() : Mage::app()->getStore()->getId(); $this->setStoreId($storeId); } if ($this->getIsCancelling() && !$this->getIsNew()) { Mage::dispatchEvent('sarp_subscription_cancel_before', array('subscription' => $this)); // Delete payment sequence Mage::getResourceModel('sarp/sequence')->deleteBySubscriptionId($this->getId()); // Delete alert events Mage::getResourceModel('sarp/alert_event')->deleteBySubscriptionId($this->getId()); // Throw payment onCancel $this->_getMethodInstance()->onSubscriptionCancel($this); } if ($this->getIsSuspending() && !$this->getIsNew()) { Mage::dispatchEvent('sarp_subscription_suspend_before', array('subscription' => $this)); $this->_getMethodInstance()->onSubscriptionSuspend($this); } if ($this->getIsReactivated() && !$this->getIsNew()) { Mage::dispatchEvent('sarp_subscription_reactivate_before', array('subscription' => $this)); $this->_getMethodInstance()->onSubscriptionReactivate($this); } if ($this->getIsExpiring() && !$this->getIsNew()) { Mage::dispatchEvent('sarp_subscription_expire_before', array('subscription' => $this)); $this->_getMethodInstance()->onSubscriptionSuspend($this); } return parent::_beforeSave(); }
public function delete() { $this->_beforeDelete(); parent::delete(); }
/** * Creates hash if no hash * @return */ public function _beforeSave() { if (!$this->getHash()) { // Generate UID if no specified $this->setHash($this->_createHash()); } return parent::_beforeSave(); }
/** * Run before save * @return */ public function _beforeSave() { if (!$this->getCreatedTime()) { $this->setCreatedTime(now()); } return parent::_beforeSave(); }