Skip to content
Snippets Groups Projects
Verified Commit 4da76f6b authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2827897 by quietone, danflanagan8, mikelutz, smustgrave, mikeryan,...

Issue #2827897 by quietone, danflanagan8, mikelutz, smustgrave, mikeryan, osopolar, xurizaemon, benjifisher: Update documentation for handling dots in the static_map plugin
parent 32e9b0f7
No related branches found
No related tags found
No related merge requests found
...@@ -29,6 +29,13 @@ ...@@ -29,6 +29,13 @@
* - default_value: (optional) The value to return if the source is not found in * - default_value: (optional) The value to return if the source is not found in
* the map array. * the map array.
* *
* While this plugin supports map key values which contain a dot (.), Drupal
* configuration export does not export keys which contain a dot. Be careful
* when using this feature with migrations that are stored as configuration
* entities. These entities cannot contain keys with a dot. In this case,
* additional manipulation with either custom or contrib process plugins is
* needed.
*
* Examples: * Examples:
* *
* If the value of the source property 'foo' is 'from' then the value of the * If the value of the source property 'foo' is 'from' then the value of the
...@@ -134,11 +141,6 @@ ...@@ -134,11 +141,6 @@
* 1: bar * 1: bar
* @endcode * @endcode
* *
* Mapping from a string which contains a period is not supported. A custom
* process plugin can be written to handle this kind of a transformation.
* Another option which may be feasible in certain use cases is to first pass
* the value through the machine_name process plugin.
*
* @see https://www.drupal.org/project/drupal/issues/2827897 * @see https://www.drupal.org/project/drupal/issues/2827897
* @see \Drupal\migrate\Plugin\MigrateProcessInterface * @see \Drupal\migrate\Plugin\MigrateProcessInterface
*/ */
......
...@@ -113,4 +113,14 @@ public function testWithNullSource() { ...@@ -113,4 +113,14 @@ public function testWithNullSource() {
$this->assertSame('mapped NULL', $value); $this->assertSame('mapped NULL', $value);
} }
/**
* Tests when there is a dot in a map key.
*/
public function testMapDotInKey(): void {
$configuration['map']['foo.bar'] = 'baz';
$this->plugin = new StaticMap($configuration, 'map', []);
$value = $this->plugin->transform('foo.bar', $this->migrateExecutable, $this->row, 'destination_property');
$this->assertSame('baz', $value);
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment