mirror of
https://github.com/wallabag/wallabag.git
synced 2025-09-10 18:51:02 +00:00
first draft of hypermedia implementation
This commit is contained in:
parent
73b7744383
commit
0f00688096
7 changed files with 166 additions and 31 deletions
|
@ -5,10 +5,12 @@ namespace Wallabag\CoreBundle\Controller;
|
|||
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Wallabag\CoreBundle\Entity\Tag;
|
||||
use Wallabag\CoreBundle\Service\Extractor;
|
||||
use Hateoas\HateoasBuilder;
|
||||
|
||||
class WallabagRestController extends Controller
|
||||
{
|
||||
|
@ -72,6 +74,9 @@ class WallabagRestController extends Controller
|
|||
throw $this->createNotFoundException();
|
||||
}
|
||||
|
||||
$hateoas = HateoasBuilder::create()->build();
|
||||
$json = $hateoas->serialize($entries, 'json');
|
||||
|
||||
return $entries;
|
||||
}
|
||||
|
||||
|
@ -87,7 +92,10 @@ class WallabagRestController extends Controller
|
|||
*/
|
||||
public function getEntryAction(Entry $entry)
|
||||
{
|
||||
return $entry;
|
||||
$hateoas = HateoasBuilder::create()->build();
|
||||
$json = $hateoas->serialize($entry, 'json');
|
||||
|
||||
return new Response($json, 200, array('application/json'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue