*/ class Mage_Api_Model_Resource_Role extends Mage_Core_Model_Resource_Db_Abstract { /** * Resource initialization * */ protected function _construct() { $this->_init('api/role', 'role_id'); } /** * Action before save * * @param Mage_Core_Model_Abstract $object * @return Mage_Api_Model_Resource_Role */ protected function _beforeSave(Mage_Core_Model_Abstract $object) { if (!$object->getId()) { $object->setCreated(now()); } $object->setModified(now()); return $this; } /** * Load an object * * @param Mage_Core_Model_Abstract $object * @param mixed $value * @param string $field field to load by (defaults to model id) * @return Mage_Core_Model_Resource_Db_Abstract */ public function load(Mage_Core_Model_Abstract $object, $value, $field = null) { if (!intval($value) && is_string($value)) { $field = 'role_id'; } return parent::load($object, $value, $field); } }