Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.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 Symfony 2 FOSUserBundle推进推进推进UserManager实现不支持此用户实例_Php_Symfony_Fosuserbundle_Propel - Fatal编程技术网

Php Symfony 2 FOSUserBundle推进推进推进UserManager实现不支持此用户实例

Php Symfony 2 FOSUserBundle推进推进推进UserManager实现不支持此用户实例,php,symfony,fosuserbundle,propel,Php,Symfony,Fosuserbundle,Propel,我正在Symfony 2.4安装中使用propel实现FOSUserBundle 我得到了这个错误: This user instance is not supported by the Propel UserManager implementation 这是我的User.php 我做错了什么? 提前谢谢 编辑: 如果我编辑FOS/UserBundle/prople/UserManager.php并注释以下行: public function updateUser(UserInterface

我正在Symfony 2.4安装中使用propel实现FOSUserBundle

我得到了这个错误:

This user instance is not supported by the Propel UserManager implementation
这是我的User.php

我做错了什么? 提前谢谢

编辑:

如果我编辑FOS/UserBundle/prople/UserManager.php并注释以下行:

public function updateUser(UserInterface $user)
{
    #if (!$user instanceof \Persistent) {
    #    throw new \InvalidArgumentException('This user instance is not supported by the Propel UserManager implementation');
    #}

    $this->updateCanonicalFields($user);
    $this->updatePassword($user);
    $user->save();
}
并将此功能添加到我的模型中:

public function save() {
    # No code at all
}
我不再犯错误了。当然,由于save实现是空的,所以我的users表中没有任何内容。 我认为这不是解决方案,如果我必须实现像save这样的东西,我不应该向manager用户提供捆绑包,我应该自己实现所有东西

求求你,我需要澄清一下……我对symfony一无所知

在我的自定义保存函数中,我使用var_dump$this;出口如评论中所述:

object(g9\BoBundle\Model\User)#546 (19) {
  ["id":protected]=>
  NULL
  ["username":protected]=>
  string(9) "asdasdasd"
  ["usernameCanonical":protected]=>
  string(9) "asdasdasd"
  ["email":protected]=>
  string(17) "asdasd@asdasd.com"
  ["emailCanonical":protected]=>
  string(17) "asdasd@asdasd.com"
  ["enabled":protected]=>
  bool(true)
  ["salt":protected]=>
  string(31) "1vnor8tdykcgs004080c8gskgcso8oc"
  ["password":protected]=>
  string(88) "ItcyRBZDjaua9EIZ050/mfp35vhag0lrumUSTcahaIWW6AQyhxG9JgA4kMVOX4WCRsyDa3rbOqmZmCaDbxi3KA=="
  ["plainPassword":protected]=>
  NULL
  ["lastLogin":protected]=>
  NULL
  ["confirmationToken":protected]=>
  NULL
  ["passwordRequestedAt":protected]=>
  NULL
  ["groups":protected]=>
  NULL
  ["locked":protected]=>
  bool(false)
  ["expired":protected]=>
  bool(false)
  ["expiresAt":protected]=>
  NULL
  ["roles":protected]=>
  array(0) {
  }
  ["credentialsExpired":protected]=>
  bool(false)
  ["credentialsExpireAt":protected]=>
  NULL
}

您自己的用户类必须是一个推进模型;出口在updateUser中,查看对象的外观。你也清除了缓存,对吗?是的,我清除了缓存。我已经编辑了这个问题。这不是解决方案,必须从其他地方执行保存功能!我在这里发疯了我在github上发布了一个问题:
object(g9\BoBundle\Model\User)#546 (19) {
  ["id":protected]=>
  NULL
  ["username":protected]=>
  string(9) "asdasdasd"
  ["usernameCanonical":protected]=>
  string(9) "asdasdasd"
  ["email":protected]=>
  string(17) "asdasd@asdasd.com"
  ["emailCanonical":protected]=>
  string(17) "asdasd@asdasd.com"
  ["enabled":protected]=>
  bool(true)
  ["salt":protected]=>
  string(31) "1vnor8tdykcgs004080c8gskgcso8oc"
  ["password":protected]=>
  string(88) "ItcyRBZDjaua9EIZ050/mfp35vhag0lrumUSTcahaIWW6AQyhxG9JgA4kMVOX4WCRsyDa3rbOqmZmCaDbxi3KA=="
  ["plainPassword":protected]=>
  NULL
  ["lastLogin":protected]=>
  NULL
  ["confirmationToken":protected]=>
  NULL
  ["passwordRequestedAt":protected]=>
  NULL
  ["groups":protected]=>
  NULL
  ["locked":protected]=>
  bool(false)
  ["expired":protected]=>
  bool(false)
  ["expiresAt":protected]=>
  NULL
  ["roles":protected]=>
  array(0) {
  }
  ["credentialsExpired":protected]=>
  bool(false)
  ["credentialsExpireAt":protected]=>
  NULL
}