Re: Design question: User objects and a Role object
- From: "R. Rajesh Jeba Anbiah" <ng4rrjanbiah@xxxxxxxxxxxxxx>
- Date: Thu, 9 Oct 2008 10:30:03 -0700 (PDT)
On Oct 9, 9:31 pm, Anthony Smith <mrsmi...@xxxxxxxxxxx> wrote:
I have a user object that is set when a user logs in. There are also
permissions that I get about the user from a web service. Currently I
take the results from those web services and store them as XML in the
user object so I can parse it when I need to look at them. I wanted to
turn the xml permissions into ROle objects, but does that mean that my
User class needs to make reference to the Role class?
User class example
class User{
protected $firstName;
protected $lastName;
protected $employeeNumber;
protected $orgCode;
protected $roles; //Could this be an object of my class Role?
protected $scope;
protected $type;
protected $primaryAssignmentsXML = null;
protected $securityRolesXML = null;
.... getters ad setters
getRole(roleName){
//get the securityRolesXML and then parse it setting the Role
Object
$role = new Role();
$role->setName();
$role->setFunction();
return $role;
}
Is this how I should be going about this?
Theoretically looks ok. But, practically you'll end up deeper
object chains which might need caching to improve performance.
--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/
.
- References:
- Design question: User objects and a Role object
- From: Anthony Smith
- Design question: User objects and a Role object
- Prev by Date: Re: swfupload class problem
- Next by Date: Re: Design question: User objects and a Role object
- Previous by thread: Design question: User objects and a Role object
- Next by thread: Re: Design question: User objects and a Role object
- Index(es):
Relevant Pages
|