public function update(User $user)
    {
        $this->dispatcher->dispatch(UserEvents::BEFORE_UPDATE, new UserEvent($user));

        $sql = 'UPDATE ' . $this->conn->quoteIdentifier($this->userTableName). '
            SET '.$this->getUserColumns('email').' = :email
            , '.$this->getUserColumns('password').' = :password
            , '.$this->getUserColumns('salt').' = :salt
            , '.$this->getUserColumns('name').' = :name
            , '.$this->getUserColumns('roles').' = :roles
            , '.$this->getUserColumns('time_created').' = :timeCreated
            , '.$this->getUserColumns('username').' = :username
            , '.$this->getUserColumns('isEnabled').' = :isEnabled
            , '.$this->getUserColumns('confirmationToken').' = :confirmationToken
            , '.$this->getUserColumns('timePasswordResetRequested').' = :timePasswordResetRequested
            WHERE '.$this->getUserColumns('id').' = :id';

        $params = array(
            'email' => $user->getEmail(),
            'password' => $user->getPassword(),
            'salt' => $user->getSalt(),
            'name' => $user->getName(),
            'roles' => implode(',', $user->getRoles()),
            'timeCreated' => $user->getTimeCreated(),
            'username' => $user->getRealUsername(),
            'isEnabled' => $user->isEnabled(),
            'confirmationToken' => $user->getConfirmationToken(),
            'timePasswordResetRequested' => $user->getTimePasswordResetRequested(),
            'id' => $user->getId(),
        );

        $this->conn->executeUpdate($sql, $params);

        $this->saveUserCustomFields($user);

        $this->dispatcher->dispatch(UserEvents::AFTER_UPDATE, new UserEvent($user));
    }
public function update(User $user)
    {
        $this->dispatcher->dispatch(UserEvents::BEFORE_UPDATE, new UserEvent($user));

        $sql = 'UPDATE ' . $this->conn->quoteIdentifier($this->userTableName). '
            SET '.$this->getUserColumns('email').' = :email
            , '.$this->getUserColumns('password').' = :password
            , '.$this->getUserColumns('salt').' = :salt
            , '.$this->getUserColumns('name').' = :name
            , '.$this->getUserColumns('roles').' = :roles
            , '.$this->getUserColumns('time_created').' = :timeCreated
            , '.$this->getUserColumns('username').' = :username
            , '.$this->getUserColumns('isEnabled').' = :isEnabled
            , '.$this->getUserColumns('confirmationToken').' = :confirmationToken
            , '.$this->getUserColumns('timePasswordResetRequested').' = :timePasswordResetRequested
            WHERE '.$this->getUserColumns('id').' = :id';

        $params = array(
            'email' => $user->getEmail(),
            'password' => $user->getPassword(),
            'salt' => $user->getSalt(),
            'name' => $user->getName(),
            'roles' => implode(',', $user->getRoles()),
            'timeCreated' => $user->getTimeCreated(),
            'username' => $user->getRealUsername(),
            'isEnabled' => $user->isEnabled(),
            'confirmationToken' => $user->getConfirmationToken(),
            'timePasswordResetRequested' => $user->getTimePasswordResetRequested(),
            'id' => $user->getId(),
        );

        $this->conn->executeUpdate($sql, $params);

        $this->saveUserCustomFields($user);

        $this->dispatcher->dispatch(UserEvents::AFTER_UPDATE, new UserEvent($user));
    }
public function update ( User $ user ) { $ this -> dispatcher -> dispatch ( UserEvents :: BEFORE_UPDATE , new UserEvent ( $ user ) ) ; $ sql = 'UPDATE ' . $ this -> conn -> quoteIdentifier ( $ this -> userTableName ) . '
            SET ' . $ this -> getUserColumns ( 'email' ) . ' = :email
            , ' . $ this -> getUserColumns ( 'password' ) . ' = :password
            , ' . $ this -> getUserColumns ( 'salt' ) . ' = :salt
            , ' . $ this -> getUserColumns ( 'name' ) . ' = :name
            , ' . $ this -> getUserColumns ( 'roles' ) . ' = :roles
            , ' . $ this -> getUserColumns ( 'time_created' ) . ' = :timeCreated
            , ' . $ this -> getUserColumns ( 'username' ) . ' = :username
            , ' . $ this -> getUserColumns ( 'isEnabled' ) . ' = :isEnabled
            , ' . $ this -> getUserColumns ( 'confirmationToken' ) . ' = :confirmationToken
            , ' . $ this -> getUserColumns ( 'timePasswordResetRequested' ) . ' = :timePasswordResetRequested
            WHERE ' . $ this -> getUserColumns ( 'id' ) . ' = :id' ; $ params = array ( 'email' => $ user -> getEmail ( ) , 'password' => $ user -> getPassword ( ) , 'salt' => $ user -> getSalt ( ) , 'name' => $ user -> getName ( ) , 'roles' => implode ( ',' , $ user -> getRoles ( ) ) , 'timeCreated' => $ user -> getTimeCreated ( ) , 'username' => $ user -> getRealUsername ( ) , 'isEnabled' => $ user -> isEnabled ( ) , 'confirmationToken' => $ user -> getConfirmationToken ( ) , 'timePasswordResetRequested' => $ user -> getTimePasswordResetRequested ( ) , 'id' => $ user -> getId ( ) , ) ; $ this -> conn -> executeUpdate ( $ sql , $ params ) ; $ this -> saveUserCustomFields ( $ user ) ; $ this -> dispatcher -> dispatch ( UserEvents :: AFTER_UPDATE , new UserEvent ( $ user ) ) ; }
Update data in the database for an existing user.

@param User $user
Update data in the database for an existing user .