- $collection = 'pathauto_state.' . $this->getEntityTypeId();
- $states = $this->keyValue->get($collection)->getMultiple(array_keys($pids_by_id));
-
- $pids = [];
- foreach ($pids_by_id as $id => $pid) {
- // Only delete aliases that were created by this module.
- if (isset($states[$id]) && $states[$id] == PathautoState::CREATE) {
- $pids[] = $pid;
- }
- }
- \Drupal::service('pathauto.alias_storage_helper')->deleteMultiple($pids);