CodeExplorer setRoleId example
$em =
$this->container->
get(ModelManager::
class);
$em->
persist($user);
$em->
flush($user);
} private function createAdminUser(): User
{ $adminRole =
$this->
getAdminRole();
$user =
new User();
$user->
setRoleId($adminRole->
getId());
$user->
setRole($adminRole);
return $user;
} private function validateInput(InputInterface
$input): void
{ $option =
$input->
getOption('email'
);
if (empty($option)) { throw new InvalidArgumentException('Email is required'
);
}