[Propel] Avoid to duplicate objects
This commit is contained in:
parent
d69144c614
commit
3910735784
@ -47,14 +47,12 @@ class CollectionToArrayTransformer implements DataTransformerInterface
|
|||||||
throw new UnexpectedTypeException($collection, '\PropelCollection');
|
throw new UnexpectedTypeException($collection, '\PropelCollection');
|
||||||
}
|
}
|
||||||
|
|
||||||
$collection->setModel($this->choiceList->getClass());
|
|
||||||
|
|
||||||
return $collection->toArray();
|
return $collection->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reverseTransform($array)
|
public function reverseTransform($array)
|
||||||
{
|
{
|
||||||
$collection = new PropelObjectCollection();
|
$collection = new PropelCollection();
|
||||||
|
|
||||||
if ('' === $array || null === $array) {
|
if ('' === $array || null === $array) {
|
||||||
return $collection;
|
return $collection;
|
||||||
@ -64,8 +62,7 @@ class CollectionToArrayTransformer implements DataTransformerInterface
|
|||||||
throw new UnexpectedTypeException($array, 'array');
|
throw new UnexpectedTypeException($array, 'array');
|
||||||
}
|
}
|
||||||
|
|
||||||
$collection->setModel($this->choiceList->getClass());
|
$collection->setData($array);
|
||||||
$collection->fromArray($array);
|
|
||||||
|
|
||||||
return $collection;
|
return $collection;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user