Skip to content

Unable to Delete Entry if It's in applenews_article Table #20

@zhua89cc

Description

@zhua89cc

Description

Similar issue to this bug #11 however my error is a return type error (see screenshot)
The deleteArticle method is expecting a return type of stdClass but I actually get an empty string. Following the chain of methods

` public function deleteArticle(string $channelId, string $articleId): stdClass
{
return $this->delete($channelId, '/articles/{article_id}', [
'article_id' => $articleId,
]);
}

calls

/**
 * Sends a DELETE request to the Apple News API.
 *
 * @param string $channelId
 * @param string $path
 * @param array $pathArgs
 * @param array $data
 * @return mixed
 */
protected function delete(string $channelId, string $path, array $pathArgs = [], array $data = [])
{
    return $this->api($channelId)->delete($path, $pathArgs, $data);
}

which instantiates publisherAPI which then calls

/**

  • Create DELETE request to a specified endpoint.
  • @param (string) $path API endpoint path.
  • @param (string) $path_args Endpoint path arguments to replace tokens in the path.
  • @param (string) $data Raw content of the request or associative array to pass to endpoints.
  • @return object Preprocessed structured object and returns 204 No Content on success, with no response body.
    */
    public function delete($path, Array $path_args = [], Array $data = []) {
    parent::delete($path, $path_args, $data);
    $this->setHeaders(
    [
    'Authorization' => $this->auth()
    ]
    );
    $this->unsetHeaders(
    [
    'Content-Type'
    ]
    );
    return $this->request($data);
    }`

We haven't changed anything on our end so this is a little strange. Unless the news api has changed their responses.

Steps to reproduce

Additional info

  • Craft version: 3.7.63.1
  • PHP version: 8
  • Database driver & version:
  • Plugins & versions: 2.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions