infinite-networks / InfiniteFormBundle

A collection of useful form types and extensions for Symfony.
169 stars 40 forks source link

Is types return array? #30

Closed chadyred closed 9 years ago

chadyred commented 9 years ago

Hey,

I have a list of type, and I have an error prompt "must be an instance of 'parentType' an array given,' not the 'type' desired because I have this : 'myFieldOnMyAssociated' => array(array('_type' =>'myapp_mybundle_mytype")) or the type that I want...

Where can I choose the good "type" child of "types" ?

This is my log

at MyParentClass ->setMyFieldOnMyAssociated (array(object(InitiativeDeclarant))) 
in vendor/symfony/symfony/src/Symfony/Component/PropertyAccess/PropertyAccessor.php at line 410  

The only thing I do is to get this array on my accesseur set and take the only one child I want like this :

 public function setMyFieldOnMyAssociated(array $arrayOfTypes)
    {
        //I take the first type 
        $this->reponse = $reponse[0];

        return $this;
    }

Thank you ! :)

chadyred commented 9 years ago

Arf! When I updated my object....he request the array...grrr

Expected argument of type "array or (\Traversable and \ArrayAccess)", "MyApp\MyBundle\Entity\MyType" given