Skip to content

Commit c5a0f86

Browse files
committed
Merge branch '4.2'
* 4.2: Updated code for Symfony 4.x Added the missing annotations to a routing example
2 parents 179a134 + 3ac87ca commit c5a0f86

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

routing/service_container_parameters.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,27 @@ inside your routing configuration:
1616

1717
.. configuration-block::
1818

19+
.. code-block:: php-annotations
20+
21+
// src/Controller/MainController.php
22+
namespace App\Controller;
23+
24+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
25+
use Symfony\Component\Routing\Annotation\Route;
26+
27+
class MainController extends AbstractController
28+
{
29+
/**
30+
* @Route("/{_locale}/contact", name="contact", requirements={
31+
* "_locale"="%app.locales%"
32+
* })
33+
*/
34+
public function contact()
35+
{
36+
// ...
37+
}
38+
}
39+
1940
.. code-block:: yaml
2041
2142
# config/routes.yaml
@@ -94,6 +115,25 @@ path):
94115

95116
.. configuration-block::
96117

118+
.. code-block:: php-annotations
119+
120+
// src/Controller/MainController.php
121+
namespace App\Controller;
122+
123+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
124+
use Symfony\Component\Routing\Annotation\Route;
125+
126+
class MainController extends AbstractController
127+
{
128+
/**
129+
* @Route("/%app.route_prefix%/contact", name="contact")
130+
*/
131+
public function contact()
132+
{
133+
// ...
134+
}
135+
}
136+
97137
.. code-block:: yaml
98138
99139
# config/routes.yaml

0 commit comments

Comments
 (0)