public static function delete($request, $match)
    {
        // Check access
        if(isset($match['userId'])){
            $user = Pluf_Shortcuts_GetObjectOr404('User_Account', $match['userId']);
        }else{
            $user = $request->user;
        }
        $profile = null;
        if (array_key_exists('profileId', $match)) {
            $profile = Pluf_Shortcuts_GetObjectOr404('User_Profile', $match['profileId']);
            if($profile->account_id !== $user->id){
                throw new Pluf_HTTP_Error404('Profile is not blong to given user');
            }
        }else{
            $profile = self::getProfileOfUser($user);
            if ($profile === null) {
                return new User_Profile();
            }
        }
        $profile->delete();
        return $profile;
    }
public static function delete($request, $match)
    {
        // Check access
        if(isset($match['userId'])){
            $user = Pluf_Shortcuts_GetObjectOr404('User_Account', $match['userId']);
        }else{
            $user = $request->user;
        }
        $profile = null;
        if (array_key_exists('profileId', $match)) {
            $profile = Pluf_Shortcuts_GetObjectOr404('User_Profile', $match['profileId']);
            if($profile->account_id !== $user->id){
                throw new Pluf_HTTP_Error404('Profile is not blong to given user');
            }
        }else{
            $profile = self::getProfileOfUser($user);
            if ($profile === null) {
                return new User_Profile();
            }
        }
        $profile->delete();
        return $profile;
    }
public static function delete ( $ request , $ match ) { // Check access if ( isset ( $ match [ 'userId' ] ) ) { $ user = Pluf_Shortcuts_GetObjectOr404 ( 'User_Account' , $ match [ 'userId' ] ) ; } else { $ user = $ request -> user ; } $ profile = null ; if ( array_key_exists ( 'profileId' , $ match ) ) { $ profile = Pluf_Shortcuts_GetObjectOr404 ( 'User_Profile' , $ match [ 'profileId' ] ) ; if ( $ profile -> account_id !== $ user -> id ) { throw new Pluf_HTTP_Error404 ( 'Profile is not blong to given user' ) ; } } else { $ profile = self :: getProfileOfUser ( $ user ) ; if ( $ profile === null ) { return new User_Profile ( ) ; } } $ profile -> delete ( ) ; return $ profile ; }
Deletes profile of specified user.

@param Pluf_HTTP_Request $request
@param array $match
@param array $p
@throws Pluf_Exception
@return Pluf_HTTP_Response_Json
Deletes profile of specified user .