[Propel] Fixed the CollectionToArray transformer

This commit is contained in:
William DURAND 2012-02-11 18:52:37 +01:00
parent 1f20fb1b7d
commit 46d28cd55d

View File

@ -35,7 +35,11 @@ class CollectionToArrayTransformer implements DataTransformerInterface
throw new UnexpectedTypeException($collection, '\PropelCollection');
}
return $collection->toArray();
// 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;
}
public function reverseTransform($array)