Skip to content

Commit 46d28cd

Browse files
committed
[Propel] Fixed the CollectionToArray transformer
1 parent 1f20fb1 commit 46d28cd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Symfony/Bridge/Propel1/Form/DataTransformer/CollectionToArrayTransformer.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ public function transform($collection)
3535
throw new UnexpectedTypeException($collection, '\PropelCollection');
3636
}
3737

38-
return $collection->toArray();
38+
// A PropelCollection is ArrayAccess, to cast the collection
39+
// into array is enough to transform the collection in an array.
40+
// Never use toArray() on a PropelCollection as it puts all data
41+
// in array, not just the collection.
42+
return (array) $collection;
3943
}
4044

4145
public function reverseTransform($array)

0 commit comments

Comments
 (0)