Doctrine does not update a simple array type field [duplicate] Doctrine does not update a simple array type field [duplicate] symfony symfony

Doctrine does not update a simple array type field [duplicate]


You can try this inside the controller:

public function updateTeamAction($team_id, Request $request){    $em = $this->getDoctrine()->getManager();    $repository= $em->getRepository('AcmeTestBundle:Team');    $team_to_update = $repository->find($team_id);    $form = $this->createForm(new teamType(), $team_to_update);    if ($request->getMethod() == 'POST')    {        $form->bind($request);        if ($form->isValid()){            $events = $team_to_update->getEvents();            foreach($events as $key => $value){                $team_to_update->removeEvent($key);            }            $em->flush();            $team_to_update->setEvents($events);            $em->persist($team_to_update);            $em->flush();            return $this->redirect($this->generateUrl('homepage'))  ;        }    }    return array(    'form' => $form->createView(),    'team_id' => $team_id,    );}

There is probably a beter way to do this and i know this isnt a nice way to do it but till you (or someone else) finds that solution you can use this as a temporary fix.