/** * @param Role $role * * @return $this */ public function addRole($role) { if (!$this->roles->contains($role)) { $this->roles->add($role); } return $this; }
/** * Adds a Role to the Collection. * * @param Role $role * * @return User */ public function addRole(Role $role) { if (!$this->hasRole($role)) { $this->roles->add($role); } return $this; }
/** * @param Role $role * * @return $this */ public function addAuthorizedRole(Role $role) { $this->authorizedRoles->add($role); return $this; }
/** * @param Role $role */ public function addRole(Role $role) { $this->roles->add($role); }
/** * @param Role $role */ public function addRole(Role $role) { if (!$this->roles->contains($role)) { $this->roles->add($role); } }
/** * Replace the old platform roles of a user by a new array. * * @param $platformRoles */ public function setPlatformRoles($platformRoles) { $roles = $this->getEntityRoles(); $removedRoles = array(); foreach ($roles as $role) { if ($role->getType() != Role::WS_ROLE) { $removedRoles[] = $role; } } foreach ($removedRoles as $removedRole) { $this->roles->removeElement($removedRole); } foreach ($platformRoles as $platformRole) { $this->roles->add($platformRole); } }
public function addChildren(Role $child, $setParentToChild = true) { $this->children->add($child); $setParentToChild && $child->setParent($this, false); }
/** * {@inheritdoc} */ public function addRole(Role $role) { if (!$this->inRole($role)) { $this->roles->add($role); } }
/** * {@inheritdoc} */ public function addAuthorizationRole(RoleInterface $role) { if (!$this->hasAuthorizationRole($role)) { $this->authorizationRoles->add($role); } }
/** * Add a child. * * @param RoleInterface|string $child * @return RoleInterface */ public function addChild($child) { $this->children->add($child); return $this; }
public function addRole(Movie $movie, $roles = null) { $roles = is_array($roles) ? $roles : []; $this->roles->add(new Role($this, $movie, $roles)); }