public function executeUpdate($request) { if ($request->isMethod('post')) { $this->setResponseFormat(); $map = Doctrine::getTable("NetworkMap")->find($request->getParameter("id")); $this->forward404Unless($map); $data = $request->getParameter("data"); $decoded = json_decode($data); $map->width = $request->getParameter("width"); $map->height = $request->getParameter("height"); $map->data = $data; $map->entity_ids = implode(",", array_values(array_map(function ($e) { return $e->id; }, $decoded->entities))); $map->rel_ids = implode(",", array_values(array_map(function ($e) { return $e->id; }, $decoded->rels))); $map->save(); LsCache::clearNetworkMapCacheById($map->id); $response = $map->toArray(); $response["data"] = json_decode($response["data"]); return $this->renderText(json_encode($response)); } //404 Not Found $this->returnStatusCode(400); }
public function executeDelete($request) { if ($request->isMethod('post')) { $this->checkMap($request); $this->checkMapOwner(); $this->map->delete(); LsCache::clearNetworkMapCacheById($this->map->id); $this->redirect("map/list"); } else { $this->forward("error", "invalid"); } }