All pastes #123952 Raw Edit

Stuff

public text v1 · immutable
·published 2006-08-09 18:37 UTC
rendered paste body
	private function getCardinalRole($userRoles)
	{

		$roleModel = $this->getGlobalModel('RoleGateway');		
		$allRoles  = $roleModel->getAll();		
		$highRole  = array('name' => '', 'cardinality' => 0);
		
		// var_dump($userRoles); works, prints out array(1) { [0]=>  string(14) "Loan Processor" }

		foreach($allRoles as $role)
		{
			
	        // var_dump($userRoles); fails, causes (seemingly) for php to freak out, and for a download dialogue to be initiated to download "index.php" (the name of the script)

			if(in_array($role->name, $userRoles) 
				&& $role->cardinality > $highRole['cardinality'])
			{
				
				$highRole = 
					array('name' => $role->name, 'cardinality' => $role->cardinality);
				
			}
			
		}
		
		return $highRole;
		
	}