-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Description
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Symfony version | 3.1.9 |
AppBundle\ExpressionLanguage\ExpressionLanguageProvider;
<?php
namespace AppBundle\ExpressionLanguage;
use Symfony\Component\ExpressionLanguage\ExpressionFunction;
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
class ExpressionLanguageProvider implements ExpressionFunctionProviderInterface
{
public function getFunctions()
{
return array(
new ExpressionFunction('test', function ($input) {
return $input;
}, function (array $values, $input) {
return $input;
}),
);
}
}
services.yml
app.security_expression_language_provider:
class: AppBundle\ExpressionLanguage\ExpressionLanguageProvider
tags:
- { name: security.expression_language_provider }
AppBundle\Controller\MyController;
<?php
namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\HttpFoundation\Response;
class MyController extends Controller
{
/**
* @Security("test()")
*/
public function listAction(Request $request)
{
return new Response();
}
}
Error: The function "test" does not exist around position 1.
adri