Add support for entity-types other than nodes

Created on 30 September 2021, about 3 years ago
Updated 27 September 2023, about 1 year ago

I set up Entity Share on two websites so that the client site imports custom entities from the server site. Pulling entities manually works perfectly. I tried to install Entity Share Websub in order to see whether it is possible to subscribe to these entities. It turns out I get this message in the client site logs:

Unable to process subscription request for 838d4f9b-773c-49d7-b30b-a0cf687019e9 from channel MY_CHANNEL of remote MY_REMOTE: Server error: `POST https://MY_DOMAIN_NAME/subscribe` resulted in a `500 500 Service unavailable (with message)` response: The website encountered an unexpected error. Please try again later.

And this one in the server site logs:

Error: Call to a member function get() on null in Drupal\entity_share_websub_hub\Subscription->save() (line 223 of /var/www/html/web/modules/contrib/entity_share_websub/modules/entity_share_websub_hub/src/Subscription.php)

As a matter of fact, it definitely looks like the Subscription::save() method only deals with nodes:

$node = Node::load(reset($existing));
$result = [
  202,
  $this->database->merge(self::TABLE_NAME)->insertFields(
    [
      // ...
      'content_summary' => $node->get('title')->value . ' : ' . $node->bundle(),
      'uid' => $node->get('uid')->target_id,
      // ...
    ])
    ->updateFields([
      'status' => $mode == 'subscribe' ? self::STATUS_ACTIVE : self::STATUS_CANCELLED,
    ])
    ->key('subscriber_endpoint', $callback)
    ->execute(),
];

Is Entity Share Websub only designed to work with nodes?

✨ Feature request
Status

Needs review

Version

1.1

Component

Code

Created by

πŸ‡«πŸ‡·France fmb PerpinyΓ , Catalonia, EU

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024