Skip to content

Instantly share code, notes, and snippets.

@vaneves
Created September 23, 2015 20:18
Show Gist options
  • Save vaneves/aa78657755e194b2479a to your computer and use it in GitHub Desktop.
Save vaneves/aa78657755e194b2479a to your computer and use it in GitHub Desktop.
Curso Ninja - API/ DELETE
<?php
$app->delete('/posts/{id}', function ($id) use ($app) {
$em = $app['orm.em'];
$post = $em->getRepository('App\Entities\Post')->find($id);
$em->remove($post);
$em->flush();
return $app->json(true);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment