File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -207,9 +207,10 @@ How to Use the Voter in a Controller
207
207
------------------------------------
208
208
209
209
The registered voter will then always be asked as soon as the method ``isGranted() ``
210
- from the authorization checker is called.
211
-
212
- .. code-block :: php
210
+ from the authorization checker is called. When extending the base ``Controller ``
211
+ class, you can simply call the
212
+ :method: `Symfony\\ Bundle\\ FrameworkBundle\\ Controller\\ Controller::denyAccessUnlessGranted() `
213
+ method::
213
214
214
215
// src/AppBundle/Controller/PostController.php
215
216
namespace AppBundle\Controller;
@@ -232,9 +233,9 @@ from the authorization checker is called.
232
233
}
233
234
234
235
.. versionadded :: 2.6
235
- The ``security.authorization_checker `` service was introduced in Symfony 2.6.
236
- Prior to Symfony 2.6, you had to use the ``isGranted() `` method of the
237
- ``security.context `` service.
236
+ The ``denyAccessUnlessGranted() `` method was introduced in Symfony 2.6.
237
+ Prior to Symfony 2.6, you had to call the ``isGranted() `` method of the
238
+ ``security.context `` service and throw the exception yourself .
238
239
239
240
It's that easy!
240
241
You can’t perform that action at this time.
0 commit comments