2014-07-23 3 views
-1

security.ylm에 내 access_control을 정의했습니다. 필자의 코드에서 ylm 파일을 '손으로'구문 분석하지 않고 현재 페이지 역할을 가져올 수 있습니까?Symfony 2 보안 : 페이지 역할 얻기

감사

+0

! 내가 바보 야? 좋아, 증명해. – Ricardo

+0

[symfony2는 security.yml에있는 access \ _control 매개 변수에 접근 할 수 있습니다] (http://stackoverflow.com/questions/19831114/symfony2-get-to-the-access-control-parameters-located-in -the-security-yml) – Ricardo

답변

0

의 그것의 중복 : 나는 코멘트를하지 않고 이러한 downvotes를 얻을 해달라고 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'];