Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Sql.php

function Sql::deleteDestination

Overrides MigrateIdMapInterface::deleteDestination

File

core/modules/migrate/src/Plugin/migrate/id_map/Sql.php, line 857

Class

Sql
Defines the sql based ID map implementation.

Namespace

Drupal\migrate\Plugin\migrate\id_map

Code

public function deleteDestination(array $destination_id_values) {
    $map_query = $this->getDatabase()
        ->delete($this->mapTableName());
    $message_query = $this->getDatabase()
        ->delete($this->messageTableName());
    $source_id_values = $this->lookupSourceId($destination_id_values);
    if (!empty($source_id_values)) {
        foreach ($this->destinationIdFields() as $field_name => $destination_id) {
            $map_query->condition($destination_id, $destination_id_values[$field_name]);
        }
        // Notify anyone listening of the map row we're about to delete.
        $this->eventDispatcher
            ->dispatch(new MigrateMapDeleteEvent($this, $source_id_values), MigrateEvents::MAP_DELETE);
        $map_query->execute();
        $message_query->condition($this::SOURCE_IDS_HASH, $this->getSourceIdsHash($source_id_values));
        $message_query->execute();
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal