Public Member Functions | |
__construct () | |
load ($roleId) | |
save (Mage_Admin_Model_Acl_Role $role) | |
delete () | |
Protected Attributes | |
$_roleTable | |
$_read | |
$_write |
Definition at line 34 of file Role.php.
__construct | ( | ) |
Definition at line 40 of file Role.php.
00041 { 00042 $this->_roleTable = Mage::getSingleton('core/resource')->getTableName('admin/role'); 00043 $this->_read = Mage::getSingleton('core/resource')->getConnection('admin_read'); 00044 $this->_write = Mage::getSingleton('core/resource')->getConnection('admin_write'); 00045 }
load | ( | $ | roleId | ) |
save | ( | Mage_Admin_Model_Acl_Role $ | role | ) |
Definition at line 54 of file Role.php.
00055 { 00056 $data = $role->getData(); 00057 00058 $this->_write->beginTransaction(); 00059 00060 try { 00061 if ($role->getId()) { 00062 $condition = $this->_write->quoteInto('role_id=?', $role->getRoleId()); 00063 $this->_write->update($this->_roleTable, $data, $condition); 00064 } else { 00065 $data['created'] = now(); 00066 $this->_write->insert($this->_roleTable, $data); 00067 $role->setRoleId($this->_write->lastInsertId()); 00068 } 00069 00070 $this->_write->commit(); 00071 } 00072 catch (Mage_Core_Exception $e) 00073 { 00074 $this->_write->rollback(); 00075 throw $e; 00076 } 00077 00078 return $role; 00079 }