Skip to content

Commit b32ec15

Browse files
committed
minor symfony#3856 Update voters_data_permission.rst (MarcomTeam)
This PR was submitted for the 2.4 branch but it was merged into the 2.3 branch instead (closes symfony#3856). Discussion ---------- Update voters_data_permission.rst Strange $product variable... Commits ------- a392e78 Update voters_data_permission.rst a2d022b Update voters_data_permission.rst
2 parents 9b7584f + 5794371 commit b32ec15

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

cookbook/security/voters_data_permission.rst

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,20 +204,16 @@ from the security context is called.
204204
205205
class PostController extends Controller
206206
{
207-
public function showAction()
207+
public function showAction($id)
208208
{
209209
// get a Post instance
210210
$post = ...;
211-
211+
212212
// keep in mind, this will call all registered security voters
213213
if (false === $this->get('security.context')->isGranted('view', $post)) {
214214
throw new AccessDeniedException('Unauthorised access!');
215215
}
216216
217-
$product = $this->getDoctrine()
218-
->getRepository('AcmeStoreBundle:Post')
219-
->find($id);
220-
221217
return new Response('<h1>'.$post->getName().'</h1>');
222218
}
223219
}

0 commit comments

Comments
 (0)