Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.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
Php Symfony2安全性:刷新用户时获取用户名_Php_Symfony_Authentication_Doctrine Orm - Fatal编程技术网

Php Symfony2安全性:刷新用户时获取用户名

Php Symfony2安全性:刷新用户时获取用户名,php,symfony,authentication,doctrine-orm,Php,Symfony,Authentication,Doctrine Orm,为什么它的refreshUser方法中的实体提供程序返回一个user对象,并将NULL作为用户名而不是实际用户名 public function refreshUser(UserInterface $user) { $class = get_class($user); if (!$this->supportsClass($class)) { throw new UnsupportedUserException( sprintf(

为什么它的
refreshUser
方法中的实体提供程序返回一个
user
对象,并将
NULL
作为用户名而不是实际用户名

public function refreshUser(UserInterface $user)
{
    $class = get_class($user);
    if (!$this->supportsClass($class)) {
        throw new UnsupportedUserException(
            sprintf(
                'Instances of "%s" are not supported.',
                $class
            )
        );
    }
    var_dump($user->getUsername()); // prints NULL 
    die();
    return $this->loadUserByUsername($user->getUsername());
}

似乎只有id属性是public。但是,用户名属性可能是私有的。
为此,对象用户的序列化使username=null。

print user对象。
id
是否已填写?