diff --git a/src/Symfony/Bridge/Propel1/Form/ChoiceList/ModelChoiceList.php b/src/Symfony/Bridge/Propel1/Form/ChoiceList/ModelChoiceList.php index ff71fe6de1..1817dd1e29 100644 --- a/src/Symfony/Bridge/Propel1/Form/ChoiceList/ModelChoiceList.php +++ b/src/Symfony/Bridge/Propel1/Form/ChoiceList/ModelChoiceList.php @@ -11,12 +11,11 @@ namespace Symfony\Bridge\Propel1\Form\ChoiceList; +use \Persistent; use Symfony\Component\Form\Exception\FormException; use Symfony\Component\Form\Exception\StringCastException; use Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList; -use \Persistent; - /** * Widely inspirated by the EntityChoiceList. * diff --git a/src/Symfony/Bridge/Propel1/Form/DataTransformer/CollectionToArrayTransformer.php b/src/Symfony/Bridge/Propel1/Form/DataTransformer/CollectionToArrayTransformer.php index 210d2c256f..98b4e8f19e 100644 --- a/src/Symfony/Bridge/Propel1/Form/DataTransformer/CollectionToArrayTransformer.php +++ b/src/Symfony/Bridge/Propel1/Form/DataTransformer/CollectionToArrayTransformer.php @@ -11,12 +11,11 @@ namespace Symfony\Bridge\Propel1\Form\DataTransformer; +use \PropelCollection; use Symfony\Component\Form\DataTransformerInterface; use Symfony\Component\Form\Exception\UnexpectedTypeException; use Symfony\Component\Form\Exception\TransformationFailedException; -use \PropelCollection; - /** * CollectionToArrayTransformer class. * @@ -35,11 +34,7 @@ class CollectionToArrayTransformer implements DataTransformerInterface throw new UnexpectedTypeException($collection, '\PropelCollection'); } - // A PropelCollection is ArrayAccess, to cast the collection - // into array is enough to transform the collection in an array. - // Never use toArray() on a PropelCollection as it puts all data - // in array, not just the collection. - return (array) $collection; + return $collection->getData(); } public function reverseTransform($array) diff --git a/src/Symfony/Bridge/Propel1/Form/Type/ModelType.php b/src/Symfony/Bridge/Propel1/Form/Type/ModelType.php index d12b8c32ac..741b6fd839 100644 --- a/src/Symfony/Bridge/Propel1/Form/Type/ModelType.php +++ b/src/Symfony/Bridge/Propel1/Form/Type/ModelType.php @@ -13,7 +13,6 @@ namespace Symfony\Bridge\Propel1\Form\Type; use Symfony\Bridge\Propel1\Form\ChoiceList\ModelChoiceList; use Symfony\Bridge\Propel1\Form\DataTransformer\CollectionToArrayTransformer; -use Symfony\Bridge\Propel1\Form\DataTransformer\ObjectToArrayTransformer; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilder;