/** * Create a new role which establishes that the specified User has the * RoleType over the OwnedEntity. * * @param \RoleType $roleType The role's type * @param strig $name The role name * @param \User $user The role is for this user * @param \OwnedEntity $ownedEntity The role is over this entity * @param string $status The current Role status, e.g. 'STATUS_PENDING' for * role requests and 'STATUS_GRANTED' for granted roles. */ public function __construct(\RoleType $roleType, \User $user, \OwnedEntity $ownedEntity, $status) { $this->roleType = $roleType; $this->setStatus($status); //$this->setName($name); $ownedEntity->addRoleDoJoin($this); $user->addRoleDoJoin($this); // @link http://www.doctrine-project.org/blog/doctrine-2-give-me-my-constructor-back.html Using constructors in Entities }