Object of class Doctrine\ORM\PersistentCollection could not be converted to string Object of class Doctrine\ORM\PersistentCollection could not be converted to string symfony symfony

Object of class Doctrine\ORM\PersistentCollection could not be converted to string


For manage a ManyToMany relation between User and Mission

in User.php:

/** * @var \Doctrine\Common\Collections\ArrayCollection *  * @ORM\ManyToMany(targetEntity="Your\SuperBundle\Entity\Mission", inversedBy="users", orphanRemoval=true) * @ORM\JoinTable(name="user_mission") */private $missions;

in Mission.php:

/** * @var \Doctrine\Common\Collections\ArrayCollection * * @ORM\ManyToMany(targetEntity="Your\SuperBundle\Entity\User", mappedBy="missions", cascade={"all"}, orphanRemoval=true) */private $users;

then for your form:

http://symfony.com/doc/current/reference/forms/types/collection.html for manage collection of Mission in your User form.

take a look at "type" and "allow_add"