我在security.ylm中定义了access_control。 是否可以在我的代码中获取当前页面角色(无需手动解析ylm文件')?
由于
答案 0 :(得分:0)
它的重复:Symfony2 get to the access_control parameters located in the security.yml
use Symfony\Component\Yaml\Yaml;
$file = sprintf("%s/config/security.yml", $this->container->getParameter('kernel.root_dir'));
$parsed = Yaml::parse(file_get_contents($file));
$access = $parsed['security']['access_control'];