diff --git a/Classes/Controller/SessionController.php b/Classes/Controller/SessionController.php index 4cebb77..aa18b4f 100644 --- a/Classes/Controller/SessionController.php +++ b/Classes/Controller/SessionController.php @@ -9,6 +9,8 @@ use PhpList\PhpList4\Domain\Model\Identity\Administrator; use PhpList\PhpList4\Domain\Model\Identity\AdministratorToken; use PhpList\PhpList4\Domain\Repository\Identity\AdministratorRepository; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -16,6 +18,8 @@ /** * This controller provides methods to create and destroy REST API sessions. * + * @Route("/api/v2") + * * @author Oliver Klee */ class SessionController extends Controller @@ -43,6 +47,9 @@ public function __construct() /** * Creates a new session (if the provided credentials are valid). * + * @Route("/sessions") + * @Method("POST") + * * @param Request $request * * @return Response diff --git a/Tests/Integration/Composer/ScriptsTest.php b/Tests/Integration/Composer/ScriptsTest.php index 0b51ef8..2daef3f 100644 --- a/Tests/Integration/Composer/ScriptsTest.php +++ b/Tests/Integration/Composer/ScriptsTest.php @@ -148,9 +148,9 @@ public function moduleRoutesConfigurationFileExists() public function moduleRoutingDataProvider(): array { return [ - 'route name' => ['phplist/rest-api.create_session'], - 'defaults' => ["defaults: { _controller: 'PhpListRestBundle:Session:create' }"], - 'methods' => ['methods: [POST]'], + 'route name' => ['phplist/rest-api.rest-api'], + 'resource' => ["resource: '@PhpListRestBundle/Controller/'"], + 'type' => ['type: annotation'], ]; } diff --git a/composer.json b/composer.json index 4a68888..166fcd2 100644 --- a/composer.json +++ b/composer.json @@ -83,14 +83,9 @@ "PhpList\\RestBundle\\PhpListRestBundle" ], "routes": { - "create_session": { - "path": "/api/v2/sessions", - "defaults": { - "_controller": "PhpListRestBundle:Session:create" - }, - "methods": [ - "POST" - ] + "rest-api": { + "resource": "@PhpListRestBundle/Controller/", + "type": "annotation" } } }