本文整理汇总了PHP中Mage_Core_Model_Abstract::getCreatedAt方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Abstract::getCreatedAt方法的具体用法?PHP Mage_Core_Model_Abstract::getCreatedAt怎么用?PHP Mage_Core_Model_Abstract::getCreatedAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Abstract
的用法示例。
在下文中一共展示了Mage_Core_Model_Abstract::getCreatedAt方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareDataForSave
protected function _prepareDataForSave(Mage_Core_Model_Abstract $object)
{
if ($this->_isPkAutoIncrement && !$object->getId()) {
$object->setCreatedAt(now());
} else {
if ($object->getCreatedAt() == '0000-00-00 00:00:00' || $object->getCreatedAt() == '') {
$object->setCreatedAt(now());
}
}
$object->setUpdatedAt(now());
$data = parent::_prepareDataForSave($object);
return $data;
}
示例2: _beforeSave
protected function _beforeSave(Mage_Core_Model_Abstract $object)
{
if (!$object->getCreatedAt()) {
$object->setCreatedAt($this->formatDate(time()));
}
return parent::_beforeSave($object);
}
示例3: _prepareDataForSave
/**
* Prepare data for save
*
* @param Mage_Core_Model_Abstract $object
* @return array
*/
protected function _prepareDataForSave(Mage_Core_Model_Abstract $object)
{
$currentTime = Varien_Date::now();
if ((!$object->getId() || $object->isObjectNew()) && !$object->getCreatedAt()) {
$object->setCreatedAt($currentTime);
}
$object->setUpdatedAt($currentTime);
$data = parent::_prepareDataForSave($object);
return $data;
}
示例4: _beforeSave
protected function _beforeSave(Mage_Core_Model_Abstract $object)
{
$date = new Zend_Date();
if (!$object->getCreatedAt()) {
$object->setCreatedAt($date->toString(self::DATE_FORMAT));
}
$object->setUpdatedAt($date->toString(self::DATE_FORMAT));
parent::_beforeSave($object);
return $this;
}
示例5: _beforeSave
/**
* Process job data before save
*
* @param Mage_Core_Model_Abstract $object
* @return Gpec_Job_Model_Resource_Job
*/
protected function _beforeSave(Mage_Core_Model_Abstract $object)
{
/**
* Update timestamp values
*/
$date = $this->formatDate(Mage::getModel('core/date')->gmtTimestamp());
if (!$object->getCreatedAt()) {
$object->setCreatedAt($date);
}
$object->setUpdatedAt($date);
return parent::_beforeSave($object);
}
示例6: _beforeSave
/**
* Before save processing
*
* @param Mage_Core_Model_Abstract $object
* @return Enterprise_Staging_Model_Resource_Staging_Action
*/
protected function _beforeSave(Mage_Core_Model_Abstract $object)
{
$staging = $object->getStaging();
if ($staging instanceof Enterprise_Staging_Model_Staging) {
if ($staging->getId()) {
$object->setStagingId($staging->getId());
$object->setStagingWebsiteId($staging->getStagingWebsiteId());
$object->setMasterWebsiteId($staging->getMasterWebsiteId());
}
}
if (!$object->getId() && !$object->getCreatedAt()) {
$value = $this->formatDate(time());
$object->setCreatedAt($value);
}
if ($object->getId()) {
$value = $this->formatDate(time());
$object->setUpdatedAt($value);
}
parent::_beforeSave($object);
return $this;
}
示例7: getExportFilename
/**
* The filename of the exported file.
*
* @param string $type the type of this document like invoice, shipment or creditmemo
* @param Mage_Core_Model_Abstract $model the model instance
*
* @return string the filename of the exported file
*/
public function getExportFilename($type, $model)
{
$type = !$type ? 'invoice' : $type;
$pattern = $this->getExportPattern($type);
if (!$pattern) {
$date = Mage::getSingleton('core/date');
$pattern = $type . $date->date('Y-m-d_H-i-s');
}
if (substr($pattern, -4) != '.pdf') {
$pattern = $pattern . '.pdf';
}
$path = strftime($pattern, strtotime($model->getCreatedAt()));
$vars = $this->getModelVars($model);
return strtr($path, $vars);
}
示例8: _beforeSave
/**
* Set required fields before saving model
*
* @param Mage_Core_Model_Abstract $object
* @return $this
*/
protected function _beforeSave(Mage_Core_Model_Abstract $object)
{
if (!$object->getDisplayName()) {
if (!$object->getFrontendLabel()) {
throw new Exception(Mage::helper('attributeSplash')->__('Splash object must have a name'));
} else {
$object->setDisplayName($object->getFrontendLabel());
}
}
if ($object->getCategoryId()) {
$category = Mage::getModel('catalog/category')->load($object->getCategoryId());
if (!$category->getId()) {
$object->setCategoryId(null);
}
} else {
$object->setCategoryId(null);
}
if (!$object->getUrlKey()) {
$object->setUrlKey($object->getname());
}
$object->setUrlKey($this->formatUrlKey($object->getUrlKey()));
$object->setUpdatedAt(now());
if (!$object->getCreatedAt()) {
$object->setCreatedAt(now());
}
return parent::_beforeSave($object);
}
示例9: _beforeSave
/**
* Automatically set the created_at datetime. Why not a timestamp? Dunno
*
* @param Mage_Core_Model_Abstract $object
* @return Mage_Core_Model_Resource_Db_Abstract|void
*/
protected function _beforeSave(Mage_Core_Model_Abstract $object)
{
if (!$object->getCreatedAt()) {
$object->setCreatedAt(new Zend_Db_Expr('NOW()'));
}
}
示例10: _beforeSave
/**
* Set required fields before saving model
*
* @param Mage_Core_Model_Abstract $object
* @return $this
*/
protected function _beforeSave(Mage_Core_Model_Abstract $object)
{
if (!$object->getDisplayName()) {
if (!$object->getFrontendLabel()) {
throw new Exception(Mage::helper('attributeSplash')->__('Splash object must have a name'));
} else {
$object->setDisplayName($object->getFrontendLabel());
}
}
if ($object->getCategoryId()) {
$category = Mage::getModel('catalog/category')->load($object->getCategoryId());
if (!$category->getId()) {
$object->setCategoryId(null);
}
} else {
$object->setCategoryId(null);
}
if (!$object->getUrlKey()) {
$object->setUrlKey($object->getname());
}
$object->setUrlKey($this->formatUrlKey($object->getUrlKey()));
$object->setUpdatedAt(now());
if (!$object->getCreatedAt()) {
$object->setCreatedAt(now());
}
if (is_array($object->getCustomFields())) {
$customFields = array();
foreach ($object->getCustomFields() as $field => $value) {
if (trim($value) !== '') {
$customFields[$field] = $value;
}
}
if (count($customFields) > 0) {
$object->setCustomFields(serialize($customFields));
} else {
$object->setCustomFIelds('');
}
}
return parent::_beforeSave($object);
}