public function updateFriend($friend)
    {
        try {
            if ($this->isBefriendedBy($friend)) {
                if (!Podium::getInstance()->db->createCommand()->delete('{{%podium_user_friend}}', [
                        'user_id' => $friend,
                        'friend_id' => $this->id
                    ])->execute()) {
                    return false;
                }
                Log::info('User unfriended', $this->id, __METHOD__);
            } else {
                if (!Podium::getInstance()->db->createCommand()->insert('{{%podium_user_friend}}', ['user_id' => $friend, 'friend_id' => $this->id])->execute()) {
                    return false;
                }
                Log::info('User befriended', $this->id, __METHOD__);
            }
            Podium::getInstance()->podiumCache->deleteElement('user.friends', $friend);
            return true;
        } catch (Exception $e) {
            Log::error($e->getMessage(), null, __METHOD__);
        }
        return false;
    }
public function updateFriend($friend)
    {
        try {
            if ($this->isBefriendedBy($friend)) {
                if (!Podium::getInstance()->db->createCommand()->delete('{{%podium_user_friend}}', [
                        'user_id' => $friend,
                        'friend_id' => $this->id
                    ])->execute()) {
                    return false;
                }
                Log::info('User unfriended', $this->id, __METHOD__);
            } else {
                if (!Podium::getInstance()->db->createCommand()->insert('{{%podium_user_friend}}', ['user_id' => $friend, 'friend_id' => $this->id])->execute()) {
                    return false;
                }
                Log::info('User befriended', $this->id, __METHOD__);
            }
            Podium::getInstance()->podiumCache->deleteElement('user.friends', $friend);
            return true;
        } catch (Exception $e) {
            Log::error($e->getMessage(), null, __METHOD__);
        }
        return false;
    }
public function updateFriend ( $ friend ) { try { if ( $ this -> isBefriendedBy ( $ friend ) ) { if ( ! Podium :: getInstance ( ) -> db -> createCommand ( ) -> delete ( '{{%podium_user_friend}}' , [ 'user_id' => $ friend , 'friend_id' => $ this -> id ] ) -> execute ( ) ) { return false ; } Log :: info ( 'User unfriended' , $ this -> id , __METHOD__ ) ; } else { if ( ! Podium :: getInstance ( ) -> db -> createCommand ( ) -> insert ( '{{%podium_user_friend}}' , [ 'user_id' => $ friend , 'friend_id' => $ this -> id ] ) -> execute ( ) ) { return false ; } Log :: info ( 'User befriended' , $ this -> id , __METHOD__ ) ; } Podium :: getInstance ( ) -> podiumCache -> deleteElement ( 'user.friends' , $ friend ) ; return true ; } catch ( Exception $ e ) { Log :: error ( $ e -> getMessage ( ) , null , __METHOD__ ) ; } return false ; }
Updates friend status for the user.
@param int $friend
@return bool
@since 0.2
Updates friend status for the user .