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
是否已填写?