-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BO - Signalement] Correction de l'édition de la composition du logement avec une superficie vide #2131
Conversation
src/Manager/SignalementManager.php
Outdated
@@ -422,7 +422,7 @@ public function updateFromInformationsLogementRequest(Signalement $signalement, | |||
public function updateFromCompositionLogementRequest(Signalement $signalement, CompositionLogementRequest $compositionLogementRequest) | |||
{ | |||
$signalement->setNatureLogement($compositionLogementRequest->getType()); | |||
$signalement->setSuperficie($compositionLogementRequest->getSuperficie()); | |||
$signalement->setSuperficie(!empty($compositionLogementRequest->getSuperficie()) ? $compositionLogementRequest->getSuperficie() : null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Du coup on peut ajouter un test sur cette méthode avec la superficie à null ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tu parles d'un test fonctionnel ? ou ajouter un test dans setSuperficie ? ou dans getSuperficie ? ou autre ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oui mais sans la couche http juste avec la base de données.
- Récupérer un nouveau signalement des fixtures
- Tester
updateFromCompositionLogementRequest
avec des valeurs qui peuvent être ànull
comme superficie dansCompositionLogementRequest
.
J'aurais préféré une correction via l'utilisation des contrainte de validation, qu'en pensez-vous ? |
D'après moi, on peut laisser le champ vide, si on ne sait pas. Donc je ne sais pas comment on gèrerait au niveau des contraintes de validation ? |
Les contrainte s'applique uniquement si la valeur est renseigné (a moins d rajouter la contrainte spécifique NotBlank), je pense que la plus adéquate serait celle la https://symfony.com/doc/current/reference/constraints/Positive.html |
Oui, ok, ça me convient ! |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relecture et tests OK
Ticket
#2104
Description
Quand la superficie n'est pas renseignée, le formulaire plantait parce qu'il attendait un null|float
Tests