Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit be94cf7

Browse filesBrowse files
MarcomTeamweaverryan
authored andcommitted
Update voters_data_permission.rst
Strange $product variable...
1 parent 9b7584f commit be94cf7
Copy full SHA for be94cf7

File tree

Expand file treeCollapse file tree

1 file changed

+4
-6
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-6
lines changed

‎cookbook/security/voters_data_permission.rst

Copy file name to clipboardExpand all lines: cookbook/security/voters_data_permission.rst
+4-6Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.