function Migration::set

Same name in other branches
  1. 9 core/modules/migrate/src/Plugin/Migration.php \Drupal\migrate\Plugin\Migration::set()
  2. 8.9.x core/modules/migrate/src/Plugin/Migration.php \Drupal\migrate\Plugin\Migration::set()
  3. 11.x core/modules/migrate/src/Plugin/Migration.php \Drupal\migrate\Plugin\Migration::set()
1 method overrides Migration::set()
TestMigrationMock::set in core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php

File

core/modules/migrate/src/Plugin/Migration.php, line 600

Class

Migration
Defines the Migration plugin.

Namespace

Drupal\migrate\Plugin

Code

public function set($property_name, $value) {
    if ($property_name == 'source') {
        // Invalidate the source plugin.
        unset($this->sourcePlugin);
    }
    elseif ($property_name === 'destination') {
        // Invalidate the destination plugin.
        unset($this->destinationPlugin);
    }
    elseif ($property_name === 'migration_dependencies') {
        $value = ($value ?: []) + [
            'required' => [],
            'optional' => [],
        ];
        if (count($value) !== 2 || !is_array($value['required']) || !is_array($value['optional'])) {
            @trigger_error("Invalid migration dependencies for {$this->id()} is deprecated in drupal:10.1.0 and will cause an error in drupal:11.0.0. See https://www.drupal.org/node/3266691", E_USER_DEPRECATED);
        }
    }
    $this->{$property_name} = $value;
    return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.