deleteDestination example

$destination_key = $id_map->currentDestination();
      if ($destination_key) {
        $map_row = $id_map->getRowByDestination($destination_key);
        if (!isset($map_row['rollback_action']) || $map_row['rollback_action'] == MigrateIdMapInterface::ROLLBACK_DELETE) {
          $this->getEventDispatcher()
            ->dispatch(new MigrateRowDeleteEvent($this->migration, $destination_key), MigrateEvents::PRE_ROW_DELETE);
          $destination->rollback($destination_key);
          $this->getEventDispatcher()
            ->dispatch(new MigrateRowDeleteEvent($this->migration, $destination_key), MigrateEvents::POST_ROW_DELETE);
        }
        // We're now done with this row, so remove it from the map.         $id_map->deleteDestination($destination_key);
      }
      else {
        // If there is no destination key the import probably failed and we can         // remove the row without further action.         $source_key = $id_map->currentSource();
        $id_map->delete($source_key);
      }
      $id_map->next();

      // Check for memory exhaustion.       if (($return = $this->checkStatus()) != MigrationInterface::RESULT_COMPLETED) {
        
$id_map->getRowByDestination(Argument::type('array'))->will(function D) {
      $destination_ids = func_get_args()[0][0];
      $return = array_reduce(self::$idMapRecordsfunction Darray $carry, array $record) use ($destination_ids) {
        if (array_merge($record$destination_ids) === $record) {
          $carry = $record;
        }
        return $carry;
      }[]);

      return $return;
    });
    $id_map->deleteDestination(Argument::type('array'))->will(function D) {
      $destination_ids = func_get_args()[0][0];
      $matching_records = array_filter(self::$idMapRecordsfunction Darray $record) use ($destination_ids) {
        return array_merge($record$destination_ids) === $record;
      });
      foreach (array_keys($matching_records) as $record_key) {
        unset(self::$idMapRecords[$record_key]);
      }
    });
    $id_map->delete(Argument::type('array'))->will(function D) {
      $source_ids = func_get_args()[0][0];
      $matching_records = array_filter(self::$idMapRecordsfunction Darray $record) use ($source_ids) {
        
Home | Imprint | This part of the site doesn't use cookies.