This commit is contained in:
William DURAND 2011-09-28 18:52:40 +03:00
parent d23257fec5
commit 0f3b38e3eb

View file

@ -10,17 +10,30 @@
namespace Propel\PropelBundle\Form\DataTransformer; namespace Propel\PropelBundle\Form\DataTransformer;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\UnexpectedTypeException; use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\Form\Exception\TransformationFailedException; use Symfony\Component\Form\Exception\TransformationFailedException;
use Propel\PropelBundle\Form\ChoiceList\ModelChoiceList; use Symfony\Component\Form\DataTransformerInterface;
use \PropelCollection; use \PropelCollection;
use \PropelObjectCollection; use \PropelObjectCollection;
use Propel\PropelBundle\Form\ChoiceList\ModelChoiceList;
/**
* ModelsToArrayTransformer class.
*
* @author William Durand <william.durand1@gmail.com>
* @author Pierre-Yves Lebecq <py.lebecq@gmail.com>
*/
class ModelsToArrayTransformer implements DataTransformerInterface class ModelsToArrayTransformer implements DataTransformerInterface
{ {
/**
* @var \Propel\PropelBundle\Form\ChoiceList\ModelChoiceList
*/
private $choiceList; private $choiceList;
/**
* @param \Propel\PropelBundle\Form\ChoiceList\ModelChoiceList $choiceList
*/
public function __construct(ModelChoiceList $choiceList) public function __construct(ModelChoiceList $choiceList)
{ {
$this->choiceList = $choiceList; $this->choiceList = $choiceList;
@ -32,7 +45,7 @@ class ModelsToArrayTransformer implements DataTransformerInterface
return array(); return array();
} }
if (!($collection instanceof PropelCollection)) { if (!$collection instanceof PropelCollection) {
throw new UnexpectedTypeException($collection, '\PropelCollection'); throw new UnexpectedTypeException($collection, '\PropelCollection');
} }