3
0
Fork 0
mirror of https://github.com/farmOS/farmOS.git synced 2024-02-23 11:37:38 +01:00

Generalize migration event subscriber so that more events can be added.

This commit is contained in:
Michael Stenta 2021-09-14 13:30:40 -04:00
parent b90f00e5ed
commit 359a1f8aea
2 changed files with 16 additions and 8 deletions

View file

@ -1,6 +1,6 @@
services:
post_migration_subscriber:
class: Drupal\farm_migrate\EventSubscriber\PostMigrationSubscriber
farm_migrate_event_subscriber:
class: Drupal\farm_migrate\EventSubscriber\FarmMigrationSubscriber
arguments:
[ '@database', '@datetime.time' ]
tags:

View file

@ -9,11 +9,9 @@ use Drupal\migrate\Event\MigrateImportEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
* Class PostMigrationSubscriber.
*
* Run our user flagging after the last node migration is run.
* Farm migration event subscriber.
*/
class PostMigrationSubscriber implements EventSubscriberInterface {
class FarmMigrationSubscriber implements EventSubscriberInterface {
/**
* The database service.
@ -30,7 +28,7 @@ class PostMigrationSubscriber implements EventSubscriberInterface {
protected $time;
/**
* PostMigrationSubscriber Constructor.
* FarmMigrationSubscriber Constructor.
*
* @param \Drupal\Core\Database\Connection $database
* The database service.
@ -53,12 +51,22 @@ class PostMigrationSubscriber implements EventSubscriberInterface {
}
/**
* Run post migration logic.
* Run post-migration logic.
*
* @param \Drupal\migrate\Event\MigrateImportEvent $event
* The import event object.
*/
public function onMigratePostImport(MigrateImportEvent $event) {
$this->addRevisionLogMessage($event);
}
/**
* Add a revision log message to imported entities.
*
* @param \Drupal\migrate\Event\MigrateImportEvent $event
* The import event object.
*/
public function addRevisionLogMessage(MigrateImportEvent $event) {
// Define the migration groups that we will post-process and their
// corresponding entity revision tables.