@@ -130,9 +130,7 @@ Using Expressions for Complex Security Restrictions
130130If your security logic is a little bit more complex, you can use an :doc: `expression </components/expression_language >`
131131inside ``@Security ``. In the following example, a user can only access the
132132controller if their email matches the value returned by the ``getAuthorEmail() ``
133- method on the ``Post `` object:
134-
135- .. code-block :: php
133+ method on the ``Post `` object::
136134
137135 use AppBundle\Entity\Post;
138136 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
@@ -163,9 +161,7 @@ need to repeat the expression code using Twig syntax:
163161 {% endif %}
164162
165163The easiest solution - if your logic is simple enough - is to add a new method
166- to the ``Post `` entity that checks if a given user is its author:
167-
168- .. code-block :: php
164+ to the ``Post `` entity that checks if a given user is its author::
169165
170166 // src/AppBundle/Entity/Post.php
171167 // ...
@@ -185,9 +181,7 @@ to the ``Post`` entity that checks if a given user is its author:
185181 }
186182 }
187183
188- Now you can reuse this method both in the template and in the security expression:
189-
190- .. code-block :: php
184+ Now you can reuse this method both in the template and in the security expression::
191185
192186 use AppBundle\Entity\Post;
193187 use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
@@ -217,9 +211,7 @@ Checking Permissions without @Security
217211The above example with ``@Security `` only works because we're using the
218212:ref: `ParamConverter <best-practices-paramconverter >`, which gives the expression
219213access to the ``post `` variable. If you don't use this, or have some other
220- more advanced use-case, you can always do the same security check in PHP:
221-
222- .. code-block :: php
214+ more advanced use-case, you can always do the same security check in PHP::
223215
224216 /**
225217 * @Route("/{id}/edit", name="admin_post_edit")
@@ -257,9 +249,7 @@ of magnitude easier than :doc:`ACLs </security/acl>` and will give
257249you the flexibility you need in almost all cases.
258250
259251First, create a voter class. The following example shows a voter that implements
260- the same ``getAuthorEmail() `` logic you used above:
261-
262- .. code-block :: php
252+ the same ``getAuthorEmail() `` logic you used above::
263253
264254 namespace AppBundle\Security;
265255
@@ -343,9 +333,7 @@ To enable the security voter in the application, define a new service:
343333 tags :
344334 - { name: security.voter }
345335
346- Now, you can use the voter with the ``@Security `` annotation:
347-
348- .. code-block :: php
336+ Now, you can use the voter with the ``@Security `` annotation::
349337
350338 /**
351339 * @Route("/{id}/edit", name="admin_post_edit")
@@ -357,9 +345,7 @@ Now, you can use the voter with the ``@Security`` annotation:
357345 }
358346
359347You can also use this directly with the ``security.authorization_checker `` service or
360- via the even easier shortcut in a controller:
361-
362- .. code-block :: php
348+ via the even easier shortcut in a controller::
363349
364350 /**
365351 * @Route("/{id}/edit", name="admin_post_edit")
0 commit comments