Support empty strings as overrides properly#22
Conversation
mficzel
left a comment
There was a problem hiding this comment.
I wonder wether what the actual use case is here. I could set an override to an empty string but this would still yield an fallback string in the fronend.
I think it would make more sense to add a validator to the override that ensures no empty overrides are created. Or do you have a usecase where an empty override would be a feature. In that case we can discuss the expected behavior in the frontend.
|
The right way would be not allowing empty overrides get into the overrides table in first place. Nevertheless i think the override attribute is supposed to mirror the exact state of the record in the override table. In this case empty strings are not be considered as null. |
|
After discussion we decided to treat empty overrides as a feature and allow to create them. |
By updating a translation in backend module, it is allowed to set empty string as translation. As a result we have a record in sitegeist_csvpo_domain_translationoverride with empty string as the translation. On the other hand when it comes to overrides the code sees empty strings as null and gives the option to "add" a new override with the same keys which are already in the table, which causes a doctrine dbal exception.
We have two options
1- Do not allow empty strings in update action.
2- Reflect the exact state of the override table and update records.
In this branch the second option is implemented.