Mage_Admin_Model_Mysql4_Acl_Role Class Reference

List of all members.

Public Member Functions

 __construct ()
 load ($roleId)
 save (Mage_Admin_Model_Acl_Role $role)
 delete ()

Protected Attributes

 $_roleTable
 $_read
 $_write


Detailed Description

Definition at line 34 of file Role.php.


Constructor & Destructor Documentation

__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     }


Member Function Documentation

delete (  ) 

Definition at line 81 of file Role.php.

00082     {
00083             
00084     }

load ( roleId  ) 

Definition at line 47 of file Role.php.

00048     {
00049         $select = $this->_read->select()->from($this->_roleTable)
00050             ->where("role_id=?", $roleId);
00051         return $this->_read->fetchRow($select);
00052     }

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     }


Member Data Documentation

$_read [protected]

Definition at line 37 of file Role.php.

$_roleTable [protected]

Definition at line 36 of file Role.php.

$_write [protected]

Definition at line 38 of file Role.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:22:41 2009 for Magento by  doxygen 1.5.8