I have a Symfony2 form with a variety of fields, including one optional text field called recap
.
This recap
field saves perfectly when there\'s
True, lost many hours on it ;-( the "transformation" is hardcoded in component Form.php line 1113 !
private function viewToNorm($value)
{
$transformers = $this->config->getViewTransformers();
if (!$transformers) {
return '' === $value ? null : $value;
}
for ($i = count($transformers) - 1; $i >= 0; --$i) {
$value = $transformers[$i]->reverseTransform($value);
}
return $value;
}
In my opinion, its a big error (because is the role of DataTransformer, not Form). So the solution is to create your own DataTransformer and associate it to the text type. Currently I am losing so much time with Symfony2, always seeking in the sources these kind of little hack ;-(