Browse Source

[DoctrineBundle] Form transformers shouldn't explode if they're passed null as a value

Jordi Boggiano 14 years ago
parent
commit
b8987e1bde

+ 4 - 0
src/Symfony/Bundle/DoctrineBundle/Form/ValueTransformer/CollectionToStringTransformer.php

@@ -138,6 +138,10 @@ class CollectionToStringTransformer extends BaseValueTransformer
      */
     public function transform($value)
     {
+        if (null === $value) {
+            return '';
+        }
+
         $values = array();
         $em = $this->getOption('em');
         $reflField = $em->getClassMetadata($this->getOption('class_name'))