[Propel] Fixed typo, removed useless use statement, used getData() instead of casting a PropelCollection
This commit is contained in:
parent
46d28cd55d
commit
88b826d4f6
@ -11,12 +11,11 @@
|
||||
|
||||
namespace Symfony\Bridge\Propel1\Form\ChoiceList;
|
||||
|
||||
use \Persistent;
|
||||
use Symfony\Component\Form\Exception\FormException;
|
||||
use Symfony\Component\Form\Exception\StringCastException;
|
||||
use Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList;
|
||||
|
||||
use \Persistent;
|
||||
|
||||
/**
|
||||
* Widely inspirated by the EntityChoiceList.
|
||||
*
|
||||
|
@ -11,12 +11,11 @@
|
||||
|
||||
namespace Symfony\Bridge\Propel1\Form\DataTransformer;
|
||||
|
||||
use \PropelCollection;
|
||||
use Symfony\Component\Form\DataTransformerInterface;
|
||||
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
||||
use Symfony\Component\Form\Exception\TransformationFailedException;
|
||||
|
||||
use \PropelCollection;
|
||||
|
||||
/**
|
||||
* CollectionToArrayTransformer class.
|
||||
*
|
||||
@ -35,11 +34,7 @@ class CollectionToArrayTransformer implements DataTransformerInterface
|
||||
throw new UnexpectedTypeException($collection, '\PropelCollection');
|
||||
}
|
||||
|
||||
// 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;
|
||||
return $collection->getData();
|
||||
}
|
||||
|
||||
public function reverseTransform($array)
|
||||
|
@ -13,7 +13,6 @@ namespace Symfony\Bridge\Propel1\Form\Type;
|
||||
|
||||
use Symfony\Bridge\Propel1\Form\ChoiceList\ModelChoiceList;
|
||||
use Symfony\Bridge\Propel1\Form\DataTransformer\CollectionToArrayTransformer;
|
||||
use Symfony\Bridge\Propel1\Form\DataTransformer\ObjectToArrayTransformer;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilder;
|
||||
|
||||
|
Reference in New Issue
Block a user