_init('aw_hdu3/template', 'id'); } /** * @param Mage_Core_Model_Abstract $object * * @return $this|Mage_Core_Model_Resource_Db_Abstract */ protected function _beforeSave(Mage_Core_Model_Abstract $object) { if (is_array($object->getStoreIds())) { if (in_array(0, $object->getStoreIds())) { $object->setStoreIds(array(0)); } $object->setStoreIds(implode(',', $object->getStoreIds())); } return parent::_beforeSave($object); } /** * @param Mage_Core_Model_Abstract $object * * @return $this|Mage_Core_Model_Resource_Db_Abstract */ protected function _afterSave(Mage_Core_Model_Abstract $object) { $_result = parent::_afterSave($object); if (strlen($object->getStoreIds()) > 0) { $object->setStoreIds(array_map('intval', explode(',', $object->getStoreIds()))); } else { $object->setStoreIds(array()); } return $_result; } /** * @param Mage_Core_Model_Abstract $object * * @return $this|Mage_Core_Model_Resource_Db_Abstract */ protected function _afterLoad(Mage_Core_Model_Abstract $object) { if (strlen($object->getStoreIds()) > 0) { $object->setStoreIds(array_map('intval', explode(',', $object->getStoreIds()))); } else { $object->setStoreIds(array()); } return parent::_afterLoad($object); } }