/** * @Delete("/{id:[0-9]+}") * * @param $id * * @return Response */ public function deleteAction($id) { $response = new Response(); /** @var Book $book */ $book = Book::findFirst(["id='{$id}'"]); if ($book === false) { return $this->createNotFoundResponse($response); } if ($book->delete() === true) { $response->setJsonContent(['status' => 'OK']); } else { $this->createErrorResponse($response, $book); } return $response; }