/** * Perform operations before object save * * @param Mage_Cms_Model_Block $object * @return Creativestyle_CheckoutByAmazon_Model_Mysql4_Log_Abstract */ protected function _beforeSave(Mage_Core_Model_Abstract $object) { if (!$object->getId()) { $object->setCreationTime(Mage::getSingleton('core/date')->gmtDate()); } return parent::_beforeSave($object); }
/** * Some processing prior to saving to database - processes the given images * and the store configuration * * @param Mage_Core_Model_Abstract $object Current faq item */ protected function _beforeSave(Mage_Core_Model_Abstract $object) { if (!$object->getId()) { $object->setCreationTime(Mage::getSingleton('core/date')->gmtDate()); } $object->setPublicationTime(Mage::app()->getLocale()->date($object->getPublicationTime(), Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT), null, false)->toString(Varien_Date::DATETIME_INTERNAL_FORMAT)); $object->setUpdateTime(Mage::getSingleton('core/date')->gmtDate()); }
/** * * * @param Mage_Core_Model_Abstract $object */ protected function _beforeSave(Mage_Core_Model_Abstract $object) { if (!$object->getId()) { $object->setCreationTime(now()); } $object->setUpdateTime(now()); return $this; }
/** * Process category data before saving * * @param Mage_Core_Model_Abstract $object * @return Zeon_Faq_Model_Mysql4_Category */ protected function _beforeSave(Mage_Core_Model_Abstract $object) { // modify create / update dates if ($object->isObjectNew() && !$object->hasCreationTime()) { $object->setCreationTime(Mage::getSingleton('core/date')->gmtDate()); } $object->setUpdateTime(Mage::getSingleton('core/date')->gmtDate()); return parent::_beforeSave($object); }
protected function _beforeSave(Mage_Core_Model_Abstract $object) { if (!$object->getId()) { $object->setCreationTime(Mage::getSingleton('core/date')->gmtDate()); } $object->setUpdateTime(Mage::getSingleton('core/date')->gmtDate()); $object->setContent(serialize($object->getContentDecode())); return $this; }
/** * Process popup data before saving * * @param Mage_Core_Model_Abstract $object * @return Etailers_Popup_Model_Resource_Popup */ protected function _beforeSave(Mage_Core_Model_Abstract $object) { /* * For two attributes which represent timestamp data in DB * we should make converting such as: * If they are empty we need to convert them into DB * type NULL so in DB they will be empty and not some default value */ // modify create / update dates if ($object->isObjectNew() && !$object->hasCreationTime()) { $object->setCreationTime(Mage::getSingleton('core/date')->gmtDate()); } $object->setUpdateTime(Mage::getSingleton('core/date')->gmtDate()); return parent::_beforeSave($object); }
protected function _beforeSave(Mage_Core_Model_Abstract $object) { /* * For two attributes which represent timestamp data in DB * we should make converting such as: * If they are empty we need to convert them into DB * type NULL so in DB they will be empty and not some default value */ foreach (array('custom_theme_from', 'custom_theme_to') as $field) { $value = !$object->getData($field) ? null : $object->getData($field); $object->setData($field, $this->formatDate($value)); } // modify create / update dates if ($object->isObjectNew() && !$object->hasCreationTime()) { $object->setCreationTime(Mage::getSingleton('core/date')->gmtDate()); } $object->setUpdateTime(Mage::getSingleton('core/date')->gmtDate()); return parent::_beforeSave($object); }