Skip to content

Commit

Permalink
Fix up event dispatch to the new order.
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-vessey committed Oct 10, 2023
1 parent 365d83d commit 407c886
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/MigrateBatchExecutable.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function finishBatch($success, $results, $ops, $interval) {
*/
public function teardownMigration() {
$this->getQueue()->deleteQueue();
$this->getEventDispatcher()->dispatch(MigrateEvents::POST_IMPORT, new MigrateImportEvent($this->migration, $this->message));
$this->getEventDispatcher()->dispatch(new MigrateImportEvent($this->migration, $this->message), MigrateEvents::POST_IMPORT);
$this->migration->setStatus(MigrationInterface::STATUS_IDLE);
}

Expand All @@ -191,7 +191,7 @@ protected function enqueue() {
]), 'error');
return MigrationInterface::RESULT_FAILED;
}
$this->getEventDispatcher()->dispatch(MigrateEvents::PRE_IMPORT, new MigrateImportEvent($this->migration, $this->message));
$this->getEventDispatcher()->dispatch(new MigrateImportEvent($this->migration, $this->message), MigrateEvents::PRE_IMPORT);

// Knock off migration if the requirements haven't been met.
try {
Expand Down Expand Up @@ -276,11 +276,11 @@ protected function processRowFromQueue(Row $row) {
if ($save) {
try {
$destination = $this->migration->getDestinationPlugin();
$this->getEventDispatcher()->dispatch(MigrateEvents::PRE_ROW_SAVE, new MigratePreRowSaveEvent($this->migration, $this->message, $row));
$this->getEventDispatcher()->dispatch(new MigratePreRowSaveEvent($this->migration, $this->message, $row), MigrateEvents::PRE_ROW_SAVE);
$destination_ids = $id_map->lookupDestinationIds($this->sourceIdValues);
$destination_id_values = $destination_ids ? reset($destination_ids) : [];
$destination_id_values = $destination->import($row, $destination_id_values);
$this->getEventDispatcher()->dispatch(MigrateEvents::POST_ROW_SAVE, new MigratePostRowSaveEvent($this->migration, $this->message, $row, $destination_id_values));
$this->getEventDispatcher()->dispatch(new MigratePostRowSaveEvent($this->migration, $this->message, $row, $destination_id_values), MigrateEvents::POST_ROW_SAVE);
if ($destination_id_values) {
// We do not save an idMap entry for config.
if ($destination_id_values !== TRUE) {
Expand Down

0 comments on commit 407c886

Please sign in to comment.