public function addRoleCommand($username, $role, $authenticationProvider = null)
{
$user = $this->getUserOrFail($username, $authenticationProvider);
try {
if ($this->userService->addRoleToUser($user, $role) > 0) {
$this->outputLine('Added role "%s" to accounts of user "%s".', array($role, $username));
} else {
$this->outputLine('User "%s" already had the role "%s" assigned.', array($username, $role));
}
} catch (NoSuchRoleException $exception) {
$this->outputLine('The role "%s" does not exist.', array($role));
$this->quit(2);
}
}