ParameterProcessor::processValue will not allow blank
mbtreetime opened this issue · 4 comments
So if I have a field with default of blank not null, I can't use setValue with '' to make it blank
SampleField varchar(50) default '' not null,
\Smile\GdprDump\Converter\Parameters\ParameterProcessor::processValue
if ($value === '' || $value === []) {
throw new ValidationException(sprintf('The parameter "%s" must not be empty.', $parameter->getName()));
}
Maybe adding a separate setBlank method?
Or is there another way to achieve this?
I removed that condition from my install to get it to work.
I was looking for other options:
converter: 'randomText'
parameters:
min_length: 0
max_length: 0
Would this work? But it was not exactly what I was thinking.
Edit: realized afterward that there is a min_length of at least 3.
Hi,
At first, I though you had an issue with the converter randomText
, but in fact your issue is that the converter setValue
does not allow setting an empty string, right?
I'll look into it.
There are two ways to solve this:
- Adding a new converter that forces an empty string (e.g.
setBlank
) - Allowing empty values in the converter
setValue
Fixed in release 2.3.2.
You can now use this, like in versions <2.1.0:
converter: 'setValue'
parameters:
value: ''