Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit be94cf7

Browse files
MarcomTeamweaverryan
MarcomTeam
authored andcommitted
Update voters_data_permission.rst
Strange $product variable...
1 parent 9b7584f commit be94cf7

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

cookbook/security/voters_data_permission.rst

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,20 +204,18 @@ 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
210-
$post = ...;
210+
$post = $this->getDoctrine()
211+
->getRepository('AcmeStoreBundle:Post')
212+
->find($id);
211213
212214
// keep in mind, this will call all registered security voters
213215
if (false === $this->get('security.context')->isGranted('view', $post)) {
214216
throw new AccessDeniedException('Unauthorised access!');
215217
}
216218
217-
$product = $this->getDoctrine()
218-
->getRepository('AcmeStoreBundle:Post')
219-
->find($id);
220-
221219
return new Response('<h1>'.$post->getName().'</h1>');
222220
}
223221
}

0 commit comments

Comments
 (0)