Scalr\Acl\Acl::getAccountRoleByRow PHP Method

getAccountRoleByRow() public method

Gets Account role using record from acl_account_role
public getAccountRoleByRow ( array $rec ) : Scalr\Acl\Role\AccountRoleObject
$rec array Record from acl_account_role
return Scalr\Acl\Role\AccountRoleObject Returns AccountRoleObject for the specified ID of account role. It returns null if object does not exist.
    public function getAccountRoleByRow($rec)
    {
        if ($rec !== false) {
            $baseRole = $this->getRole($rec['role_id']);
            if (!$baseRole) {
                //Hardly probable case because of that foreign key is responsible for this
                throw new Exception\AclException(sprintf("Base ACL role (role_id:%d) does not exist.", $rec['role_id']));
            }
            $role = new Role\AccountRoleObject($baseRole, $rec['account_id'], $rec['account_role_id'], $rec['name'], $rec['color'], $rec['is_automatic']);
            $this->loadRolePermissions($role);
        }
        return isset($role) ? $role : null;
    }