Skip to content

Commit

Permalink
[Propel] Fixed the CollectionToArray transformer
Browse files Browse the repository at this point in the history
  • Loading branch information
willdurand committed Feb 11, 2012
1 parent 1f20fb1 commit 46d28cd
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -35,7 +35,11 @@ public function transform($collection)
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)
Expand Down

0 comments on commit 46d28cd

Please sign in to comment.