Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Security Symfony2 getToken()在工厂中为空_Security_Symfony_Token - Fatal编程技术网

Security Symfony2 getToken()在工厂中为空

Security Symfony2 getToken()在工厂中为空,security,symfony,token,Security,Symfony,Token,我有一个工厂返回用户的帐户。 在我的工厂中,我的参数“security.context”如下所示: ml.account.factory: class: MYLAPS\AccountBundle\Factory\AccountFactory arguments: context: "@security.context" 当我想从安全上下文中获取令牌时,它是空的。 当我调用控制器中的security.context服务,

我有一个工厂返回用户的帐户。 在我的工厂中,我的参数
“security.context”
如下所示:

  ml.account.factory:          
        class: MYLAPS\AccountBundle\Factory\AccountFactory
        arguments:
          context: "@security.context"
当我想从安全上下文中获取令牌时,它是空的。 当我调用控制器中的security.context服务,然后请求
getToken()
时,它不是空的,我看到了我的用户

似乎在
安全性.context
正确初始化之前调用了我的工厂。 有没有办法把它弄到手

先谢谢你


Steven.

您是否尝试过这样定义服务参数:
参数:[@security.context]
?MYLAPS\AccountBundle\Factory\AccountFactory的构造函数是什么样的?
@security.context
真的是第一个参数吗?