Skip to content

Instantly share code, notes, and snippets.

@jenkoian
Last active March 22, 2016 19:38
Show Gist options
  • Save jenkoian/bf5ff2c80179b0583285 to your computer and use it in GitHub Desktop.
Save jenkoian/bf5ff2c80179b0583285 to your computer and use it in GitHub Desktop.
Custom request matcher compiler pass
<?php
//...
use ...CallableCompilerPass;
//...
protected function configurePasses(ContainerBuilder $c)
{
$c->addCompilerPass(new CallableCompilerPass(function (ContainerBuilder $c) {
if (!$c->hasDefinition(‘security.access_map’)) {
return;
}
$accessMapDefinition = $c->getDefinition(‘security.access_map’);
$accessMapDefinition->addMethodCall(‘add’, [new Reference(‘app.permission_url_request_matcher’)]);
}));
}
@javiereguiluz
Copy link

@jenkoian in new Reference(‘pp.permission_url_request_matcher’) there is probably a typo. Maybe you meant: new Reference(‘app.permission_url_request_matcher’)

@jenkoian
Copy link
Author

@javiereguiluz thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment