FOS\UserBundle\Model\UserInterface::addRole PHP Method

addRole() public method

public addRole ( $role )
    function addRole($role);

Usage Example

 protected function onSuccess(UserInterface $user, $confirmation)
 {
     // Note: if you plan on modifying the user then do it before calling the
     // parent method as the parent method will flush the changes
     $user->addRole('ROLE_NORMAL_USER');
     $user->setRegistrationStatus('complete');
     $user->setSalt($this->random_key_generator(20));
     parent::onSuccess($user, $confirmation);
     // otherwise add your functionality here
 }
All Usage Examples Of FOS\UserBundle\Model\UserInterface::addRole