Created
May 27, 2014 12:51
-
-
Save wouterj/f9b5a6175403c0b1a4b6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use Symfony\Component\HttpFoundation\Request; | |
| // deze inject je | |
| $router = ...; // router | |
| $accessMap = ...; // security.access_map | |
| $accessDecisionManager = ...; // security.access.decision_manager | |
| $route = 'admin_homepage'; | |
| $url = $router->generate($route); | |
| $request = Request::create($url); | |
| list($attributes, $channel) = $accessMap->getPatterns($request); | |
| if (null === $attributes) { | |
| return; | |
| } | |
| if ($this->accessDecisionManager->decide($token, $attributes, $request)) { | |
| // toon menu item | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment