コード例 #1
0
 /**
  * @ApiDoc()
  */
 public function deleteAction($id)
 {
     $row = $this->_model->getRow($id);
     if (!$row) {
         $view = View::create(array(), Codes::HTTP_NOT_FOUND);
         $ctx = new Context();
         $view->setContext($ctx);
         return $view;
     }
     $this->denyAccessUnlessGranted('delete', $row);
     $this->_beforeDelete($row);
     $row->delete();
     $view = View::create(array(), Codes::HTTP_NO_CONTENT);
     $ctx = new Context();
     $view->setContext($ctx);
     return $view;
 }
コード例 #2
0
 public function createViewRedirectCreated($id, Request $request, Router $router)
 {
     //there must be a better way to do that
     $getRouteName = preg_replace('#^post_(.*)$#', 'get_\\1', $request->get('_route'));
     return View::createRedirect($router->generate($getRouteName, array('id' => $id, 'version' => $request->get('version'))), Codes::HTTP_CREATED);
 }