$id_map =
$this->
getIdMap();
$destination =
$this->migration->
getDestinationPlugin();
// Loop through each row in the map, and try to roll it back.
$id_map->
rewind();
while ($id_map->
valid()) { $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();