Skip to content

Instantly share code, notes, and snippets.

@aleron75
Created December 4, 2014 11:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aleron75/25c450bc5e1f33158f18 to your computer and use it in GitHub Desktop.
Save aleron75/25c450bc5e1f33158f18 to your computer and use it in GitHub Desktop.
_beforeSave() on Magento Models
protected function _beforeSave()
{
$this->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate());
if ($this->isObjectNew() && null === $this->getCreatedAt()) {
$this->setCreatedAt(Mage::getSingleton('core/date')->gmtDate());
}
return parent::_beforeSave();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment