[Propel] Fixed typo, removed useless use statement, used getData() instead of casting a PropelCollection

This commit is contained in:
William DURAND 2012-02-11 23:16:27 +01:00
parent 46d28cd55d
commit 88b826d4f6
3 changed files with 3 additions and 10 deletions

View File

@ -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.
*

View File

@ -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)

View File

@ -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;