Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
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
295
Merge Requests
295
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
drupal
Commits
ef39eed7
Commit
ef39eed7
authored
May 02, 2016
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2613178
by mikeryan, heddn: default_value: null in static map skips empty rows
parent
e8322e4f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
core/modules/migrate/src/Plugin/migrate/process/StaticMap.php
.../modules/migrate/src/Plugin/migrate/process/StaticMap.php
+1
-1
core/modules/migrate/tests/src/Unit/process/StaticMapTest.php
.../modules/migrate/tests/src/Unit/process/StaticMapTest.php
+11
-0
No files found.
core/modules/migrate/src/Plugin/migrate/process/StaticMap.php
View file @
ef39eed7
...
...
@@ -35,7 +35,7 @@ public function transform($value, MigrateExecutableInterface $migrate_executable
}
$new_value
=
NestedArray
::
getValue
(
$this
->
configuration
[
'map'
],
$new_value
,
$key_exists
);
if
(
!
$key_exists
)
{
if
(
isset
(
$this
->
configuration
[
'default_value'
]
))
{
if
(
array_key_exists
(
'default_value'
,
$this
->
configuration
))
{
if
(
!
empty
(
$this
->
configuration
[
'bypass'
]))
{
throw
new
MigrateException
(
'Setting both default_value and bypass is invalid.'
);
}
...
...
core/modules/migrate/tests/src/Unit/process/StaticMapTest.php
View file @
ef39eed7
...
...
@@ -65,6 +65,17 @@ public function testMapWithInvalidSourceWithADefaultValue() {
$this
->
assertSame
(
$value
,
'test'
);
}
/**
* Tests when the source is invalid but there's a default value of NULL.
*/
public
function
testMapWithInvalidSourceWithANullDefaultValue
()
{
$configuration
[
'map'
][
'foo'
][
'bar'
]
=
'baz'
;
$configuration
[
'default_value'
]
=
NULL
;
$this
->
plugin
=
new
StaticMap
(
$configuration
,
'map'
,
[]);
$value
=
$this
->
plugin
->
transform
(
array
(
'bar'
),
$this
->
migrateExecutable
,
$this
->
row
,
'destinationproperty'
);
$this
->
assertNull
(
$value
);
}
/**
* Tests when the source is invalid and bypass is enabled.
*
...
...
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