use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
+use Wallabag\ApiBundle\WallabagApiBundle;
class AppKernel extends Kernel
{
new JMS\SerializerBundle\JMSSerializerBundle(),
new Nelmio\ApiDocBundle\NelmioApiDocBundle(),
new Wallabag\CoreBundle\WallabagCoreBundle(),
+ new Wallabag\ApiBundle\WallabagApiBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
resource: "@NelmioApiDocBundle/Resources/config/routing.yml"
prefix: /api/doc
-rest :
- type : rest
- resource : "routing_rest.yml"
- prefix : /api
\ No newline at end of file
+wallabag_api:
+ resource: "@WallabagApiBundle/Controller/"
+ type: annotation
+ prefix: /api
\ No newline at end of file
+++ /dev/null
-app_api :
- type: rest
- resource: "WallabagCoreBundle:Api"
- name_prefix: api_
\ No newline at end of file
--- /dev/null
+<?php
+
+namespace Wallabag\ApiBundle\Controller;
+
+use Nelmio\ApiDocBundle\Annotation\ApiDoc;
+use Symfony\Bundle\FrameworkBundle\Controller\Controller;
+use Wallabag\CoreBundle\Entity\Entries;
+use FOS\RestBundle\Controller\Annotations\Get;
+use Wallabag\CoreBundle\Entity\Users;
+
+class EntryController extends Controller
+{
+ /**
+ * Fetch an entry for a given user
+ *
+ * @Get("/u/{user}/entry/{entry}")
+ * @ApiDoc(
+ * requirements={
+ * {"name"="user", "dataType"="string", "requirement"="\w+", "description"="The username"},
+ * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
+ * }
+ * )
+ * @return Entries
+ */
+ public function getAction(Users $user, Entries $entry)
+ {
+ return $entry;
+ }
+}
--- /dev/null
+<?php
+
+namespace Wallabag\ApiBundle;
+
+use Symfony\Component\HttpKernel\Bundle\Bundle;
+
+class WallabagApiBundle extends Bundle
+{
+}
+++ /dev/null
-<?php
-
-namespace Wallabag\CoreBundle\Controller;
-
-use Nelmio\ApiDocBundle\Annotation\ApiDoc;
-use Symfony\Bundle\FrameworkBundle\Controller\Controller;
-use Wallabag\CoreBundle\Entity\Entries;
-
-class ApiController extends Controller
-{
- /**
- * @ApiDoc(
- * resource=true,
- * description="This is a demo method. Just remove it",
- * )
- */
- public function getEntryAction()
- {
- return new Entries('Blobby');
- }
-}