I want to update an entity with Doctrine2. I use a form to create and update entities. I want to send an object as parameters for my REST URL.
My code is like this :
public function putUpdateAction(Client $obj){
$em = $this->getDoctrine()->getEntityManager();
$serv = $this->getDoctrine()->getRepository("AccessRhBundle:Client")
->findOneBy(array('id' => obj->getId));
$serv->setNom($obj->getNom());
$em->merge($obj);
$em->flush();
}
#app/config/routing.yml
rest:
type : rest
resource : clientBundle\Controller\ClientController
prefix : /rest
When I call this method from my client application I get error 404 URL not found.
I try to see the debugger and the result was that url contain No route found for "PUT /api/updateClient/[object%20Object]": Method Not Allowed (Allow: GET, HEAD)
which is not defined.
Someone have an idea how I can send an object as parameters of a rest method in symfony?