[Propel] Avoid to duplicate objects

This commit is contained in:
William DURAND 2012-02-09 22:08:39 +01:00
parent d69144c614
commit 3910735784

View File

@ -47,14 +47,12 @@ class CollectionToArrayTransformer implements DataTransformerInterface
throw new UnexpectedTypeException($collection, '\PropelCollection');
}
$collection->setModel($this->choiceList->getClass());
return $collection->toArray();
}
public function reverseTransform($array)
{
$collection = new PropelObjectCollection();
$collection = new PropelCollection();
if ('' === $array || null === $array) {
return $collection;
@ -64,8 +62,7 @@ class CollectionToArrayTransformer implements DataTransformerInterface
throw new UnexpectedTypeException($array, 'array');
}
$collection->setModel($this->choiceList->getClass());
$collection->fromArray($array);
$collection->setData($array);
return $collection;
}