Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
M
migrate_devel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
migrate_devel
Commits
2f3c0a26
Commit
2f3c0a26
authored
Feb 24, 2017
by
Derimagia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More code review
parent
14b8ac54
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
9 deletions
+18
-9
README.md
README.md
+5
-3
src/EventSubscriber/MigrationEventSubscriber.php
src/EventSubscriber/MigrationEventSubscriber.php
+13
-6
No files found.
README.md
View file @
2f3c0a26
# Migrate Devel
Adds new options to
`drush migrate-import`
which allows developers to debug their migrations.
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.
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.
instead of devel in order to take advantage of
cli coloring and named variable debugging.
Options are:
*
`--migrate-debug`
- Prints out rows as they run.
*
`--migrate-debug-pre`
- Same as above
, but before the migration
is run on the row.
*
`--migrate-debug-pre`
- Same as above
before the process
is run on the row.
src/EventSubscriber/MigrationEventSubscriber.php
View file @
2f3c0a26
<?php
/**
* MigrationEventSubscriber for Debugging Migrations.
*
* @category Class
* @package migrate_devel
*/
namespace
Drupal\migrate_devel\EventSubscriber
;
use
Drupal\migrate\Event\MigrateEvents
;
...
...
@@ -11,6 +16,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
* MigrationEventSubscriber for Debugging Migrations.
*/
class
MigrationEventSubscriber
implements
EventSubscriberInterface
{
/**
* Pre Row Save Function for --migrate-debug-pre.
*
...
...
@@ -19,13 +25,14 @@ class MigrationEventSubscriber implements EventSubscriberInterface {
public
function
debugRowPreSave
(
MigratePreRowSaveEvent
$event
)
{
$row
=
$event
->
getRow
();
if
(
function_exists
(
'drush_get_option'
)
&&
drush_get_option
(
'migrate-debug-pre'
))
{
$using_drush
=
function_exists
(
'drush_get_option'
);
if
(
$using_drush
&&
drush_get_option
(
'migrate-debug-pre'
))
{
// Starting with capital letter for variables since this is actually a label.
$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
);
}
}
...
...
@@ -38,14 +45,14 @@ class MigrationEventSubscriber implements EventSubscriberInterface {
public
function
debugRowPostSave
(
MigratePostRowSaveEvent
$event
)
{
$row
=
$event
->
getRow
();
if
(
function_exists
(
'drush_get_option'
)
&&
drush_get_option
(
'migrate-debug'
))
{
$using_drush
=
function_exists
(
'drush_get_option'
);
if
(
$using_drush
&&
drush_get_option
(
'migrate-debug'
))
{
// We use kint directly here since we want to support variable naming and CLI colors.
$Source
=
$row
->
getSource
();
$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
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment