*/ class Mage_Sales_Model_Order_Creditmemo_Comment extends Mage_Sales_Model_Abstract { /** * Creditmemo instance * * @var Mage_Sales_Model_Order_Creditmemo */ protected $_creditmemo; /** * Initialize resource model */ protected function _construct() { $this->_init('sales/order_creditmemo_comment'); } /** * Declare Creditmemo instance * * @param Mage_Sales_Model_Order_Creditmemo $creditmemo * @return Mage_Sales_Model_Order_Creditmemo_Comment */ public function setCreditmemo(Mage_Sales_Model_Order_Creditmemo $creditmemo) { $this->_creditmemo = $creditmemo; return $this; } /** * Retrieve Creditmemo instance * * @return Mage_Sales_Model_Order_Creditmemo */ public function getCreditmemo() { return $this->_creditmemo; } /** * Get store object * * @return Mage_Core_Model_Store */ public function getStore() { if ($this->getCreditmemo()) { return $this->getCreditmemo()->getStore(); } return Mage::app()->getStore(); } /** * Before object save * * @return Mage_Sales_Model_Order_Creditmemo_Comment */ protected function _beforeSave() { parent::_beforeSave(); if (!$this->getParentId() && $this->getCreditmemo()) { $this->setParentId($this->getCreditmemo()->getId()); } return $this; } }