Allow a callback function for the Source path parameter

Created on 22 August 2024, 5 months ago

Problem/Motivation

The path parameter only accepts a string in the migration configuration and does not accept a callback parameter that is available in some other contributed source plugins. A callback is beneficial to provide logic such as changing file locations based on environments the migration is being ran or switching to using a test CSV file based on a Drupal configuration.

Steps to reproduce

Attempt to configure a callback function in the migration YML throws Exception error "TypeError: file_exists(): Argument #1 ($filename) must be of type string, array given in file_exists()"

source:
  plugin: csv
  path:
    callback: csv_migrate_callback_function

Proposed resolution

Modify the initializeIterator() to recognize that a callback is set for the path parameter and execute the function to set the path as a string.

Remaining tasks

Adding unit test coverage as needed.

User interface changes

None

API changes

None

Data model changes

None

✨ Feature request
Status

Active

Version

3.6

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States webbywe

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024