From eb11597f9c110a1a7c72fb873a164d34428d613b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Fri, 1 Oct 2021 16:38:35 +0200 Subject: [PATCH] [CenterType] switch to hidden type with null value when no center is reachable --- CHANGELOG.md | 3 +++ src/Bundle/ChillMainBundle/Form/Type/CenterType.php | 5 +---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36e2a9bdc..5ca39903c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ and this project adheres to * [Household editor][UI] Update how household suggestion and addresses are picked; * [AddAddress] Handle address suggestion; +* [CenterType][Create a person] when overriding the ACL rules, allow to show a PickCenterType + when no centers are reachable by the default ACL. + ## Test release yyyy-mm-dd diff --git a/src/Bundle/ChillMainBundle/Form/Type/CenterType.php b/src/Bundle/ChillMainBundle/Form/Type/CenterType.php index 0366e8ccf..14ac63e8c 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/CenterType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/CenterType.php @@ -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;