public function transferRoles(User $from, User $to)
    {
        $roles = $from->getEntityRoles();

        foreach ($roles as $role) {
            $to->addRole($role);
        }

        $this->objectManager->flush();

        return count($roles);
    }
public function transferRoles(User $from, User $to)
    {
        $roles = $from->getEntityRoles();

        foreach ($roles as $role) {
            $to->addRole($role);
        }

        $this->objectManager->flush();

        return count($roles);
    }
public function transferRoles ( User $ from , User $ to ) { $ roles = $ from -> getEntityRoles ( ) ; foreach ( $ roles as $ role ) { $ to -> addRole ( $ role ) ; } $ this -> objectManager -> flush ( ) ; return count ( $ roles ) ; }
Merges two users and transfers every resource to the kept user.

@param User $from
@param User $to
Merges two users and transfers every resource to the kept user .