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
Allow blank value for mobile phone #29381
Conversation
tom-combet
commented
Aug 17, 2022
Questions | Answers |
---|---|
Branch? | develop |
Description? | Allow blank value for mobile phone in customer address |
Type? | bug fix |
Category? | BO |
BC breaks? | no |
Deprecations? | no |
Fixed ticket? | Fixes #29379. |
Related PRs | N/A |
How to test? | Edit customer address with blank mobile phone |
Possible impacts? | None |
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.
IIRC when you do that, you are setting empty values in database instead of values. Empty phone numbers should IMO be saved as null.
I think the fix should focus constraint instead of editing submitted data. You can play with validation groups to allow null in bo, and disallow in front office.
Which constraint do you make reference to?
The issue doesn't concern FO at all, the Symfony types are only used in BO. By the way, why should it be different in FO? |
With the Which constraint disallows null values ? If you want to allow The |
It's not a matter of constraints. If you look at the code, the mobile phone is updated only if the new value is not null (see here). Otherwise, it keeps the old value already present in database. I was not aware of the empty_data debate though, so maybe it's better to open an other PR to remove completely |
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.
I think we can accept it to fix the bug and think about other solutions later.
It shouldn't be any problem for now, as we have empty values in this field by default...
The problem for me is with the empty_data function , you'll never have null values, and this is a problem for me as when you are submitting a form, this field will always be updated.
@kpodemski what do you mean by empty ? |
I thinkl the correct fix here is to compare the value of the object, and the value in the command, if they are different, the we can trigger the update. The fix is for me not at the form level, but at the command level: we should allow to set null in the customer with the CQRS command |
I think it's a good idea, but maybe in an other PR? I can but doing it only for phone field is weird, isn't it? |
ping @FabienPapet - can we unblock this PR? It's a nasty bug that is easily solvable. It's not an ideal way of doing things, but it's the same for other fields too. |
Thanks, @FabienPapet - I appreciate it. It would be great to have a PoC of how you'd like to see it solved the right way. |
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.
Hello @tom-combet ,
I've tested with PHP 7.4 / PHP 8.0 ✔️
Automated tests => OK
Untitled_.Jan.13.2023.8_42.AM.webm
It's QA approved ✔️
thank you for your PR 🚀
Thank you, @tom-combet ! |