{"issue":{"state":"open","created_at":"2011-11-22T20:56:28Z","updated_at":"2011-11-22T21:09:20Z","comments":1,"user":{"gravatar_id":"47a8fe9ed227e9c56cd5dba93c2c9118","id":626664,"url":"https://api.github.com/users/jonathaningram","login":"jonathaningram","avatar_url":"https://secure.gravatar.com/avatar/47a8fe9ed227e9c56cd5dba93c2c9118?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"body":"`Notice: Undefined index: parameter_mapping_name in vendor/bundles/JMS/SecurityExtraBundle/Security/Authorization/Expression/Compiler/ParameterExpressionCompiler.php line 58`\r\n\r\nThis is my method declaration:\r\n\r\n```php\r\n<?php\r\n\r\n/**\r\n * {@inheritdoc}\r\n * \r\n * @PreAuthorize(\"hasPermission(#project.getCompany(), 'OPERATOR') or hasRole('ROLE_SUPERUSER')\")\r\n */\r\npublic function updateProject(ProjectInterface $project)\r\n{\r\n     \r\n}\r\n```","assignee":null,"id":2322931,"labels":[],"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"number":22,"title":"Notice: Undefined index: parameter_mapping_name","html_url":"https://github.com/schmittjoh/JMSSecurityExtraBundle/issues/22","closed_at":null,"url":"https://api.github.com/repos/schmittjoh/JMSSecurityExtraBundle/issues/22","milestone":null},"action":"created","comment":{"created_at":"2011-11-22T21:09:20Z","updated_at":"2011-11-22T21:09:20Z","user":{"gravatar_id":"47a8fe9ed227e9c56cd5dba93c2c9118","id":626664,"url":"https://api.github.com/users/jonathaningram","login":"jonathaningram","avatar_url":"https://secure.gravatar.com/avatar/47a8fe9ed227e9c56cd5dba93c2c9118?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"body":"More information:\r\n\r\nIn `JMS\\SecurityExtraBundle\\Security\\Authorization\\Expression\\ExpressionCompiler`, we have:\r\n\r\n```php\r\n<?php\r\n\r\npublic function compilePreconditions(ExpressionInterface $expr)\r\n    {\r\n        if ($typeCompiler = $this->findTypeCompiler(get_class($expr))) {\r\n            $typeCompiler->compilePreconditions($this, $expr);\r\n\r\n            return $this;\r\n        }\r\n\r\n        if ($expr instanceof FunctionExpression) {\r\n            $this->getFunctionCompiler($expr->name)->compilePreconditions($this, $expr);\r\n\r\n            foreach ($expr->args as $arg) {\r\n                $this->compilePreconditions($arg);\r\n            }\r\n\r\n            return $this;\r\n        }\r\n\r\n        if ($expr instanceof VariableExpression) {\r\n            $this->getVariableCompiler($expr->name)->compilePreconditions($this, $expr);\r\n\r\n            return $this;\r\n        }\r\n\r\n        return $this;\r\n    }\r\n```\r\nThe `$expr` argument looks like this:\r\n\r\n```\r\nJMS\\SecurityExtraBundle\\Security\\Authorization\\Expression\\Ast\\MethodCallExpression object {\r\n  CLASSNAME => (string) JMS\\SecurityExtraBundle\\Security\\Authorization\\Expression\\Ast\\MethodCallExpression\r\n  object => JMS\\SecurityExtraBundle\\Security\\Authorization\\Expression\\Ast\\ParameterExpression object {\r\n    CLASSNAME => (string) JMS\\SecurityExtraBundle\\Security\\Authorization\\Expression\\Ast\\ParameterExpression\r\n    name => (string) project\r\n  }\r\n  method => (string) getCompany\r\n  args => array(0)\r\n}\r\n```\r\n\r\nand so the preconditions for this are not compiled because that type does not match any in the method.\r\n\r\nThus, once we get to `JMS\\SecurityExtraBundle\\Security\\Authorization\\Expression\\Compiler\\ParameterExpressionCompiler`:\r\n\r\n```php\r\n<?php\r\n\r\npublic function compile(ExpressionCompiler $compiler, ExpressionInterface $parameter)\r\n    {\r\n        $compiler\r\n            ->compileInternal(new VariableExpression('object'))\r\n            ->write(\"->arguments[\");\r\n        $compiler\r\n            ->write(\"\\${$compiler->attributes['parameter_mapping_name']}\")\r\n            ->write(\"['{$parameter->name}']]\")\r\n        ;\r\n    }\r\n```\r\n\r\n`$compiler->attributes['parameter_mapping_name']` is empty.","id":2840712,"url":"https://api.github.com/repos/schmittjoh/JMSSecurityExtraBundle/issues/comments/2840712"}}