Commit 14b8ac54 authored by Derimagia's avatar Derimagia

Small coding and comment changes

parent 226c3a13
......@@ -2,9 +2,12 @@
Adds new options to `drush migrate-import` which allows developers to debug their migrations.
`drush migrate-import` comes from either the [migrate_tools](https://www.drupal.org/project/migrate_tools) or the [migrate_run](https://www.drupal.org/project/migrate_run) modules.
`drush migrate-import` comes from either the
[migrate_tools](https://www.drupal.org/project/migrate_tools) or the
[migrate_run](https://www.drupal.org/project/migrate_run) modules.
Currently uses Kint (from devel) directly to print out debug information instead of devel in order to take advantage of cli coloring and named variable debugging.
Currently uses Kint (from devel) directly to print out debug information
instead of devel in order to take advantage of cli coloring and named variable debugging.
Options are:
......
......@@ -4,6 +4,6 @@ package: Migrate
type: module
core: 8.x
dependencies:
- devel
- migrate
- kint
- drupal:devel
- drupal:migrate
- drupal:kint
......@@ -2,4 +2,4 @@ services:
migrate_devel.migrate_event_subscriber:
class: Drupal\migrate_devel\EventSubscriber\MigrationEventSubscriber
tags:
- { name: event_subscriber }
\ No newline at end of file
- { name: event_subscriber }
......@@ -8,11 +8,12 @@ use Drupal\migrate\Event\MigratePreRowSaveEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
* MigrationEventSubscriber for Debugging Migrations
* MigrationEventSubscriber for Debugging Migrations.
*/
class MigrationEventSubscriber implements EventSubscriberInterface {
/**
* Pre Row Save Function
* Pre Row Save Function for --migrate-debug-pre.
*
* @param \Drupal\migrate\Event\MigratePreRowSaveEvent $event
*/
public function debugRowPreSave(MigratePreRowSaveEvent $event) {
......@@ -22,13 +23,16 @@ class MigrationEventSubscriber implements EventSubscriberInterface {
$Source = $row->getSource();
$Destination = $row->getDestination();
// We use kint directly here since we want to support variable naming and CLI colors.
kint_require();
// Starting with capital letter for variables since this is actually a label.
\Kint::dump($Source, $Destination);
}
}
/**
* Post Row Save Function
* Post Row Save Function for --migrate-debug.
*
* @param \Drupal\migrate\Event\MigratePostRowSaveEvent $event
*/
public function debugRowPostSave(MigratePostRowSaveEvent $event) {
......@@ -39,7 +43,9 @@ class MigrationEventSubscriber implements EventSubscriberInterface {
$Destination = $row->getDestination();
$DestinationIDValues = $event->getDestinationIdValues();
// We use kint directly here since we want to support variable naming and CLI colors.
kint_require();
// Starting with capital letter for variables since this is actually a label.
\Kint::dump($Source, $Destination, $DestinationIDValues);
}
}
......@@ -52,4 +58,5 @@ class MigrationEventSubscriber implements EventSubscriberInterface {
$events[MigrateEvents::POST_ROW_SAVE][] = ['debugRowPostSave'];
return $events;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment