Sfoglia il codice sorgente

merged branch elnur/entities-to-array-transformer (PR #2053)

Commits
-------

6bd1749 Fixed a bug when multiple expanded choices would render unchecked because of the Form Framework's strict type checking.

Discussion
----------

[DoctrineBridge] Entities to array transformer

Fixed a bug when multiple expanded choices would render unchecked because of the Form Framework's strict type checking.

---------------------------------------------------------------------------

by fabpot at 2011/08/31 09:01:47 -0700

Looks good to me. Can you squash your commits before I merge? Thanks.
Fabien Potencier 14 anni fa
parent
commit
78346ae43b

+ 2 - 1
src/Symfony/Bridge/Doctrine/Form/DataTransformer/EntitiesToArrayTransformer.php

@@ -57,7 +57,8 @@ class EntitiesToArrayTransformer implements DataTransformerInterface
             }
         } else {
             foreach ($collection as $entity) {
-                $array[] = current($this->choiceList->getIdentifierValues($entity));
+                $value = current($this->choiceList->getIdentifierValues($entity));
+                $array[] = is_numeric($value) ? (int) $value : $value;
             }
         }