File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -204,20 +204,18 @@ from the security context is called.
204
204
205
205
class PostController extends Controller
206
206
{
207
- public function showAction()
207
+ public function showAction($id )
208
208
{
209
209
// get a Post instance
210
- $post = ...;
210
+ $post = $this->getDoctrine()
211
+ ->getRepository('AcmeStoreBundle:Post')
212
+ ->find($id);
211
213
212
214
// keep in mind, this will call all registered security voters
213
215
if (false === $this->get('security.context')->isGranted('view', $post)) {
214
216
throw new AccessDeniedException('Unauthorised access!');
215
217
}
216
218
217
- $product = $this->getDoctrine()
218
- ->getRepository('AcmeStoreBundle:Post')
219
- ->find($id);
220
-
221
219
return new Response('<h1 >'.$post->getName().'</h1 >');
222
220
}
223
221
}
You can’t perform that action at this time.
0 commit comments