Expected an object, but got a collection
Bonjour,
J'ai un petit problème assez étrange.
J'ai un controller EventController
avec ce code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
public function createAction()
{
$entity = new Event();
$request = $this->getRequest();
$form = $this->createForm(new EventType(), $entity);
$form->bindRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getEntityManager();
$em->persist($entity);
$em->flush();
return $this->redirect($this->generateUrl('Event_show', array('id' => $entity->getId())));
}
return array(
'entity' => $entity,
'form' => $form->createView()
);
} |
j'ai cette route :
Code:
1 2 3 4
|
New_Event:
pattern: /New_Event
defaults: { _controller: ApplyTechBundle:Event:create } |
et lorsque je vais sur la page correspondante j'ai ce message d'erreur:
Code:
1 2 3
|
Expected an object, but got a collection. Did you forget to pass "multiple=true" to an entity field?
500 Internal Server Error - InvalidArgumentException |