Unverified Commit 499e358a authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3197749 by quietone, joachim: empty migrate source does not populate fields with constants

parent 203ad064
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -15,8 +15,9 @@
 *     field_name: image
 * @endcode
 *
 * This will return a single row containing 'entity_type' and 'field_name'
 * elements, with values of 'user' and 'image', respectively.
 * This will return a single row containing 'constants/entity_type' and
 * 'constants/field_name' elements, with values of 'user' and 'image',
 * respectively.
 *
 * @MigrateSource(
 *   id = "empty",
+16 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@
 *   (optional table alias). This high_water_property is typically a timestamp
 *   or serial id showing what was the last imported record. Only content with a
 *   higher value will be imported.
 * - constants: (optional) An array of constants that can be used in the process
 *   pipeline. To use the constant 'foo' as a source value use 'constants/foo'.
 *
 * The high_water_property and track_changes are mutually exclusive.
 *
@@ -58,6 +60,20 @@
 * migration. This will get converted into a SQL condition that looks like
 * 'n.changed' or 'changed' if no alias.
 *
 * Example:
 *
 * @code
 * source:
 *   plugin: some_source_plugin_name
 *   constants:
 *     - foo: bar
 * process:
 *   baz: constants/bar
 * @endcode
 *
 * In this example, the constant 'foo' is defined with a value of 'bar'. It is
 * later used in the process pipeline to set the value of the field baz.
 *
 * @see \Drupal\migrate\Plugin\MigratePluginManager
 * @see \Drupal\migrate\Annotation\MigrateSource
 * @see \Drupal\migrate\Plugin\MigrateSourceInterface