H
H
hatman2018-09-25 07:09:09
symfony
hatman, 2018-09-25 07:09:09

Why the system does not allow to delete the user?

I'm trying to delete a user in symphony

if($userOriginal === $userDoubleCheck){
            $entityManager = $this->getDoctrine()->getManager();
            $entityManager->remove($userDoubleCheck);
            $entityManager->flush();

The system throws the error
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.
But in the user class I have id serialization
/** @see \Serializable::serialize() */
    public function serialize()
    {
        return serialize(array(
            $this->id,
            $this->username,
            $this->password,
//            $this->roles,
            // see section on salt below
            // $this->salt,
        ));
    }

    /** @see \Serializable::unserialize() */
    public function unserialize($serialized)
    {
        list (
            $this->id,
            $this->username,
            $this->password,
//            $this->roles,
            // see section on salt below
            // $this->salt
            ) = unserialize($serialized, array('allowed_classes' => false));
    }

those. how would I pass the id. I don't understand why she still swears at me.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question