Skip to content

Commit f2c7541

Browse files
committed
minor #11159 Added the missing annotations to a routing example (javiereguiluz)
This PR was merged into the 3.4 branch. Discussion ---------- Added the missing annotations to a routing example Commits ------- e18236c Added the missing annotations to a routing example
2 parents a4a9da3 + e18236c commit f2c7541

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/AppBundle/Controller/MainController.php
22+
namespace AppBundle\Controller;
23+
24+
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
25+
use Symfony\Component\Routing\Annotation\Route;
26+
27+
class MainController extends Controller
28+
{
29+
/**
30+
* @Route("/{_locale}/contact", name="contact", requirements={
31+
* "_locale"="%app.locales%"
32+
* })
33+
*/
34+
public function contactAction()
35+
{
36+
// ...
37+
}
38+
}
39+
1940
.. code-block:: yaml
2041
2142
# app/config/routing.yml
@@ -90,6 +111,25 @@ path):
90111

91112
.. configuration-block::
92113

114+
.. code-block:: php-annotations
115+
116+
// src/AppBundle/Controller/MainController.php
117+
namespace AppBundle\Controller;
118+
119+
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
120+
use Symfony\Component\Routing\Annotation\Route;
121+
122+
class MainController extends Controller
123+
{
124+
/**
125+
* @Route("/%app.route_prefix%/contact", name="contact")
126+
*/
127+
public function contactAction()
128+
{
129+
// ...
130+
}
131+
}
132+
93133
.. code-block:: yaml
94134
95135
# app/config/routing.yml

0 commit comments

Comments
 (0)