Ejemplo n.º 1
0
 protected function registerFunctions()
 {
     parent::registerFunctions();
     $this->register('is_granted', function ($attributes, $object = null) {
         return '$security_context->isGranted($attributes, $object)';
     }, function (array $variables, $attributes, $object = null) {
         return $variables['security_context']->isGranted($attributes, $object);
     });
 }
Ejemplo n.º 2
0
 protected function registerFunctions()
 {
     parent::registerFunctions();
     $this->register('is_granted', function ($attributes, $object = 'null') {
         return sprintf('$auth_checker->isGranted(%s, %s)', $attributes, $object);
     }, function (array $variables, $attributes, $object = null) {
         return $variables['auth_checker']->isGranted($attributes, $object);
     });
 }