Controller/EntitiesController.php
public function putEntitiesAction(ParamFetcherInterface $paramFetcher, $id) {
       	$entityName = $paramFetcher->get("entity");
    	$modelLoader = $this->get("togu.generator.model.config");
    	if(! $modelLoader->hasModel($entityName)) {
    		throw new NotFoundHttpException("Entity $entityName is not defined");
    	}
    	$manager = $this->get('doctrine_phpcr.odm.default_document_manager');
        $entity = $manager->getRepository($modelLoader->getFullClassName($entityName))->find($id);
        if ($entity === null) {
            return $this->handleView(View::create('', 404));
        }
        $serializer = $this->get("tpg_extjs.phpcr_serializer");
        $entity = $serializer->deserialize(
            $this->getRequest()->getContent(),
            $modelLoader->getFullClassName($entityName),
            'json',
            DeserializationContext::create()->setGroups(array("Default", "put"))
        );
        $validator = $this->get('validator', array('Default', 'put'));
        $validations = $validator->validate($entity);
        if ($validations->count() === 0) {
            try {
                $manager->merge($entity);
                $manager->flush();
            } catch (DBALException $e) {
                return $this->handleView(
                    View::create(array('errors'=>array($e->getMessage())), 400)
                );
            }
            return $this->handleView(
                View::create(array(
		        	"success" => $entity !== null,
		        	"total" => $entity !== null ? 1 : 0,
		        	"records" => array($entity)
		        ), 200)->setSerializationContext($this->getSerializerContext(array("get")))
            );
        } else {
            return $this->handleView(
                View::create(array('errors'=>$validations), 400)
            );
        }
    }
public function putEntitiesAction(ParamFetcherInterface $paramFetcher, $id) {
       	$entityName = $paramFetcher->get("entity");
    	$modelLoader = $this->get("togu.generator.model.config");
    	if(! $modelLoader->hasModel($entityName)) {
    		throw new NotFoundHttpException("Entity $entityName is not defined");
    	}
    	$manager = $this->get('doctrine_phpcr.odm.default_document_manager');
        $entity = $manager->getRepository($modelLoader->getFullClassName($entityName))->find($id);
        if ($entity === null) {
            return $this->handleView(View::create('', 404));
        }
        $serializer = $this->get("tpg_extjs.phpcr_serializer");
        $entity = $serializer->deserialize(
            $this->getRequest()->getContent(),
            $modelLoader->getFullClassName($entityName),
            'json',
            DeserializationContext::create()->setGroups(array("Default", "put"))
        );
        $validator = $this->get('validator', array('Default', 'put'));
        $validations = $validator->validate($entity);
        if ($validations->count() === 0) {
            try {
                $manager->merge($entity);
                $manager->flush();
            } catch (DBALException $e) {
                return $this->handleView(
                    View::create(array('errors'=>array($e->getMessage())), 400)
                );
            }
            return $this->handleView(
                View::create(array(
		        	"success" => $entity !== null,
		        	"total" => $entity !== null ? 1 : 0,
		        	"records" => array($entity)
		        ), 200)->setSerializationContext($this->getSerializerContext(array("get")))
            );
        } else {
            return $this->handleView(
                View::create(array('errors'=>$validations), 400)
            );
        }
    }
Update an existing record
@param $id

@Route(requirements={"id"=".+"})

@QueryParam(name="entity", description="EntityName", default="")
@return \Symfony\Component\HttpFoundation\Response