[CenterType] switch to hidden type with null value when no center is

reachable
This commit is contained in:
2021-10-01 16:38:35 +02:00
parent 0b57b3c74d
commit eb11597f9c
2 changed files with 4 additions and 4 deletions

View File

@@ -76,10 +76,7 @@ class CenterType extends AbstractType
{
$nbReachableCenters = count($this->reachableCenters);
if ($nbReachableCenters === 0) {
throw new \RuntimeException("The user is not associated with "
. "any center. Associate user with a center");
} elseif ($nbReachableCenters === 1) {
if ($nbReachableCenters <= 1) {
return HiddenType::class;
} else {
return EntityType::class;