Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
c1cf341b
Commit
c1cf341b
authored
Apr 06, 2014
by
alexpott
Browse files
Issue
#2222169
by David Hernández: Add skip_row option to StaticMap.
parent
9de62afc
Changes
2
Hide whitespace changes
Inline
Side-by-side
core/modules/migrate/lib/Drupal/migrate/Plugin/migrate/process/StaticMap.php
View file @
c1cf341b
...
...
@@ -12,6 +12,7 @@
use
Drupal\migrate\MigrateException
;
use
Drupal\migrate\MigrateExecutable
;
use
Drupal\migrate\Row
;
use
Drupal\migrate\MigrateSkipRowException
;
/**
* This plugin changes the current value based on a static lookup map.
...
...
@@ -46,7 +47,7 @@ public function transform($value, MigrateExecutable $migrate_executable, Row $ro
return
$this
->
configuration
[
'default_value'
];
}
if
(
empty
(
$this
->
configuration
[
'bypass'
]))
{
throw
new
MigrateException
(
sprintf
(
'Lookup of %s failed.'
,
var_export
(
$value
,
TRUE
))
);
throw
new
Migrate
SkipRow
Exception
();
}
else
{
return
$value
;
...
...
core/modules/migrate/tests/Drupal/migrate/Tests/process/StaticMapTest.php
View file @
c1cf341b
...
...
@@ -68,7 +68,7 @@ public function testMapwithEmptySource() {
/**
* Tests when the source is invalid.
*
* @expectedException \Drupal\migrate\MigrateException
* @expectedException \Drupal\migrate\Migrate
SkipRow
Exception
*/
public
function
testMapwithInvalidSource
()
{
$this
->
plugin
->
transform
(
array
(
'bar'
),
$this
->
migrateExecutable
,
$this
->
row
,
'destinationproperty'
);
...
...
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