[Form] Fixed: set data is treated as string except if a transformer is set

This commit is contained in:
Bernhard Schussek 2011-03-27 23:09:46 +02:00
parent cfaa03eeec
commit 4ec6ba8674

View File

@ -255,12 +255,9 @@ class Form implements \IteratorAggregate, FormInterface
$this->dispatcher->dispatch(Events::filterSetData, $event); $this->dispatcher->dispatch(Events::filterSetData, $event);
$appData = $event->getData(); $appData = $event->getData();
// Fix data if empty // Treat data as strings unless a value transformer exists
if (!$this->clientTransformer) { if (!$this->clientTransformer && !$this->normTransformer && is_scalar($appData)) {
// Treat data as strings unless a value transformer exists $appData = (string)$appData;
if (is_scalar($appData)) {
$appData = (string)$appData;
}
} }
// Synchronize representations - must not change the content! // Synchronize representations - must not change the content!