Getting the "do not update user" error with symfony2 and the doctrine

I have a User class as a base class, then I extended Teacher from a user class.

When I try to log in, I get this error

You cannot upgrade a user from EntityUserProvider that does not contain an identifier. A custom object must be serialized using its own identifier displayed by Doctrine.

I have a serialization / deserialization function in user.php since I dealt with this from FOSUserbundle

public function serialize()
    {
        return serialize(array(
            $this->password,
            $this->salt,
            $this->usernameCanonical,
            $this->username,
            $this->expired,
            $this->locked,
            $this->credentialsExpired,
            $this->enabled,
        ));
    }

I cannot find where I can check for an error. I am stuck. please, help

+5
source share
3 answers

code EntityUserProvider.php , id .

+4
"You cannot refresh a user from the EntityUserProvider that does not contain an identifier. The user object has to be serialized with its own identifier mapped by Doctrine."

, - ( ), . , , .

, . ( , !) , .

$this->get('security.context')->setToken(null);
$this->get('request')->getSession()->invalidate();
+6

, id, private, id, protected.

0

All Articles