This is a minor nit ... but I just want to clear it up.

    foreach ($entities as $entity) {
      \Drupal::service('event_dispatcher')
        ->dispatch(FlagEvents::FLAG_DELETED, new FlagDeleteEvent($entity));
    }

if the number of $entities is large the number of redundant calls to service('event_displatcher') will start to show.

CommentFileSizeAuthor
event-1.patch620 bytesmartin107
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

martin107 created an issue. See original summary.

socketwench’s picture

Status: Needs review » Reviewed & tested by the community

Good catch!

joachim’s picture

Status: Reviewed & tested by the community » Fixed

Thanks!

  • joachim committed 813bd45 on 8.x-4.x authored by martin107
    Issue #2585977 by martin107: Changed Flag::preDelete() to get service...

Status: Fixed » Closed (fixed)

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