Skip to content

Commit 959ff84

Browse files
committed
Use XML for routing to remove dependency to SensioFrameworkExtra.
1 parent abe1688 commit 959ff84

File tree

5 files changed

+21
-14
lines changed

5 files changed

+21
-14
lines changed

Controller/DocumentationController.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
use Dunglas\JsonLdApiBundle\Response\JsonLdResponse;
1515
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
16-
use Symfony\Component\HttpFoundation\Response;
17-
use Symfony\Component\Routing\Annotation\Route;
1816

1917
/**
2018
* Generates API documentation.
@@ -27,8 +25,6 @@ class DocumentationController extends Controller
2725
* Serves the entrypoint of the API.
2826
*
2927
* @return JsonLdResponse
30-
*
31-
* @Route(name="json_ld_api_entrypoint", path="/")
3228
*/
3329
public function entrypointAction()
3430
{
@@ -38,9 +34,7 @@ public function entrypointAction()
3834
/**
3935
* Namespace of types specific to the current API.
4036
*
41-
* @return Response
42-
*
43-
* @Route(name="json_ld_api_vocab", path="/vocab")
37+
* @return JsonLdResponse
4438
*/
4539
public function vocabAction()
4640
{
@@ -53,8 +47,6 @@ public function vocabAction()
5347
* @param string $shortName
5448
*
5549
* @return JsonLdResponse
56-
*
57-
* @Route(name="json_ld_api_context", path="/contexts/{shortName}")
5850
*/
5951
public function contextAction($shortName)
6052
{

Resources/config/routing.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
3+
<routes xmlns="http://symfony.com/schema/routing"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://symfony.com/schema/routing
6+
http://symfony.com/schema/routing/routing-1.0.xsd">
7+
8+
<route id="json_ld_api_entrypoint" path="/">
9+
<default key="_controller">DunglasJsonLdApiBundle:Documentation:entrypoint</default>
10+
</route>
11+
12+
<route id="json_ld_api_vocab" path="/vocab">
13+
<default key="_controller">DunglasJsonLdApiBundle:Documentation:vocab</default>
14+
</route>
15+
16+
<route id="json_ld_api_context" path="/contexts/{shortName}">
17+
<default key="_controller">DunglasJsonLdApiBundle:Documentation:context</default>
18+
</route>
19+
</routes>

composer.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"phpdocumentor/reflection-docblock": "~2.0"
2626
},
2727
"require-dev": {
28-
"sensio/framework-extra-bundle": "~3.0",
2928
"phpspec/phpspec": "~2.0",
3029
"behat/behat": "~3.0",
3130
"behat/symfony2-extension": "~2.0",
@@ -35,7 +34,6 @@
3534
"behatch/contexts": "~2.2"
3635
},
3736
"suggest": {
38-
"sensio/framework-extra-bundle": "Automatically load documentation routes.",
3937
"friendsofsymfony/user-bundle": "To use the FOSUserBundle bridge."
4038
},
4139
"autoload": {

features/fixtures/TestApp/AppKernel.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ public function registerBundles()
3232
return [
3333
new FrameworkBundle(),
3434
new DoctrineBundle(),
35-
new SensioFrameworkExtraBundle(),
3635
new DunglasJsonLdApiBundle(),
3736
new TestBundle(),
3837
];

features/fixtures/TestApp/config/routing.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
api_doc:
2-
resource: "@DunglasJsonLdApiBundle/Controller/"
3-
type: "annotation"
2+
resource: "@DunglasJsonLdApiBundle/Resources/config/routing.xml"
43

54
api:
65
resource: "."

0 commit comments

Comments
 (0)