Remove these function and all calls to them within the module. Replacement is Subscriber::load() and related functions.

Fix on 8.x-2.x so can just delete without needing to bother with deprecation.

Full list of functions to remove:

  • simplenews_subscriber_load() => Subscriber::load()
  • simplenews_subscriber_load_by_mail() => Subscriber::loadByMail()
  • simplenews_subscriber_load_by_uid() => Subscriber::loadByUid()
  • simplenews_subscriber_load_multiple() => Subscriber::loadMultiple()
  • simplenews_subscriber_delete_multiple() => Use the entity storage's delete() method
  • simplenews_newsletter_load() => Newsletter::load()
  • simplenews_newsletter_load_multiple() => Newsletter::loadMultiple()

Comments

AdamPS created an issue. See original summary.

adamps’s picture

Title: Deprecate simplenews_subscriber_load_XXX » Deprecate entity load/delete wrappers
Issue summary: View changes
adamps’s picture

Title: Deprecate entity load/delete wrappers » Deprecate or delete entity load/delete wrappers
Issue summary: View changes
adamps’s picture

Title: Deprecate or delete entity load/delete wrappers » Delete entity load/delete wrappers
Version: 8.x-1.x-dev » 8.x-2.x-dev
Issue summary: View changes
w.drupal’s picture

Assigned: Unassigned » w.drupal
Status: Active » Needs work
w.drupal’s picture

w.drupal’s picture

Status: Needs work » Needs review

@AdamPS please review

adamps’s picture

Great thanks. I am travelling now, so will review late next week.

adamps’s picture

Status: Needs review » Needs work

Many thanks w@drupal it is a good patch.

Here are my comments:

1. In simplenews_newsletter_get_visible(), don't need $newsletters =

2. Everywhere that calls loadMultiple(): better to use Newsletter::loadMultiple(); (and same for Subscriber). instead of

\Drupal::entityTypeManager()->getStorage('simplenews_newsletter')->loadMultiple();

3. Sorry this is my fault. The code to replace simplenews_subscriber_load_by_mail() and simplenews_subscriber_load_by_uid() is more complex that I realised, it's not just one line. So I think we do still need a function for it, but we need to do it in the D8 way. I suggest Subscriber::loadByMail() and Subscriber::loadByUid().

w.drupal’s picture

@AdamPS, I've applied changes that you listed above. I didn't change loadMultiple() method calls if a storage is used for other goals, e.g.

  protected function resetSubscribers() {
    $storage = \Drupal::entityTypeManager()->getStorage('simplenews_subscriber');
    $storage->delete($storage->loadMultiple());
  }
w.drupal’s picture

Status: Needs work » Needs review
adamps’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Plan to commit

Thanks, it's good, I will commit it.

adamps’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed
Issue tags: -Plan to commit

Many thanks w@drupal

  • AdamPS committed 612a905 on 8.x-2.x authored by w@drupal
    Issue #3055868 by w@drupal: Delete entity load/delete wrappers
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.