doushe8577 2014-07-21 15:20
浏览 29

Symfony 2 FOSUserBundle Propel Propel UserManager实现不支持此用户实例

I'm implementing FOSUserBundle (with propel) on my Symfony 2.4 installation.

I'm getting this error:

This user instance is not supported by the Propel UserManager implementation

This is my User.php

namespace g9\BoBundle\Model;

use FOS\UserBundle\Model\User as MyUser;

class User extends MyUser{
    # .. no code here yet
}

What am I doing wrong? Thanks in advance

EDIT:

If I edit FOS/UserBundle/Propel/UserManager.php and comment the following lines:

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();
}

And add this function to my Model:

public function save() {
    # No code at all
}

I stop getting erros. And sure, I get nothing into my users table since save() implementation is empty. I think this is NOT the solution, If i have to implement something like save() I shouldnt get a Bundle to manager users, i should implement everything myself.

Please, I need some clarity here..i know nothing of symfony.

On my custom save() function i did var_dump($this); exit; as sugested in comments:

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
}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog