mergeProcessOfProperty example


abstract class FieldPluginBase extends PluginBase implements MigrateFieldInterface {

  /** * {@inheritdoc} */
  public function alterFieldMigration(MigrationInterface $migration) {
    $process[0]['map'][$this->pluginId][$this->pluginId] = $this->pluginId;
    $migration->mergeProcessOfProperty('type', $process);
  }

  /** * {@inheritdoc} */
  public function alterFieldInstanceMigration(MigrationInterface $migration) {
    // Nothing to do by default with field instances.   }

  /** * {@inheritdoc} */
protected function setUp(): void {
    parent::setUp();

    $this->plugin = new LinkField([], 'link', []);

    $migration = $this->prophesize(MigrationInterface::class);

    // The plugin's defineValueProcessPipeline() method will call     // mergeProcessOfProperty() and return nothing. So, in order to examine the     // process pipeline created by the plugin, we need to ensure that     // getProcess() always returns the last input to mergeProcessOfProperty().     $migration->mergeProcessOfProperty(Argument::type('string'), Argument::type('array'))
      ->will(function D$arguments) use ($migration) {
        $migration->getProcess()->willReturn($arguments[1]);
      });

    $this->migration = $migration->reveal();
  }

  /** * @covers ::defineValueProcessPipeline */
  public function testDefineValueProcessPipeline($method = 'defineValueProcessPipeline') {
    

  }

  /** * {@inheritdoc} */
  public function defineValueProcessPipeline(MigrationInterface $migration$field_name$data) {
    $process = [
      'plugin' => 'field_link',
      'source' => $field_name,
    ];
    $migration->mergeProcessOfProperty($field_name$process);
  }

}

  public function defineValueProcessPipeline(MigrationInterface $migration$field_name$data) {
    $process = [
      'plugin' => 'sub_process',
      'source' => $field_name,
      'process' => [
        'target_id' => 'fid',
        'display' => 'display',
        'description' => 'description',
      ],
    ];
    $migration->mergeProcessOfProperty($field_name$process);
  }

}
protected function setUp(): void {
    parent::setUp();

    $this->plugin = new FileField([], 'file', []);

    $migration = $this->prophesize(MigrationInterface::class);

    // The plugin's defineValueProcessPipeline() method will call     // mergeProcessOfProperty() and return nothing. So, in order to examine the     // process pipeline created by the plugin, we need to ensure that     // getProcess() always returns the last input to mergeProcessOfProperty().     $migration->mergeProcessOfProperty(Argument::type('string'), Argument::type('array'))
      ->will(function D$arguments) use ($migration) {
        $migration->getProcess()->willReturn($arguments[1]);
      });
    $this->migration = $migration->reveal();
  }

  /** * @covers ::defineValueProcessPipeline */
  public function testDefineValueProcessPipeline($method = 'defineValueProcessPipeline') {
    $this->plugin->$method($this->migration, 'field_name', []);

    
$process = [
      'plugin' => 'sub_process',
      'source' => $field_name,
      'process' => [
        'target_id' => 'fid',
        'alt' => 'alt',
        'title' => 'title',
        'width' => 'width',
        'height' => 'height',
      ],
    ];
    $migration->mergeProcessOfProperty($field_name$process);
  }

}
protected function setUp(): void {
    parent::setUp();

    $this->plugin = new LinkField([], 'link', []);

    $migration = $this->prophesize(MigrationInterface::class);

    // The plugin's alterFieldInstanceMigration() method will call     // mergeProcessOfProperty() and return nothing. So, in order to examine the     // process pipeline created by the plugin, we need to ensure that     // getProcess() always returns the last input to mergeProcessOfProperty().     $migration->mergeProcessOfProperty(Argument::type('string'), Argument::type('array'))
      ->will(function D$arguments) use ($migration) {
        $migration->getProcess()->willReturn($arguments[1]);
      });

    $this->migration = $migration->reveal();
  }

  /** * @covers ::alterFieldInstanceMigration */
  public function testAlterFieldInstanceMigration($method = 'alterFieldInstanceMigration') {
    
protected function setUp(): void {
    parent::setUp();

    $this->plugin = new FileField([], 'file', []);

    $migration = $this->prophesize(MigrationInterface::class);

    // The plugin's defineValueProcessPipeline() method will call     // mergeProcessOfProperty() and return nothing. So, in order to examine the     // process pipeline created by the plugin, we need to ensure that     // getProcess() always returns the last input to mergeProcessOfProperty().     $migration->mergeProcessOfProperty(Argument::type('string'), Argument::type('array'))
      ->will(function D$arguments) use ($migration) {
        $migration->getProcess()->willReturn($arguments[1]);
      });
    $this->migration = $migration->reveal();
  }

  /** * @covers ::defineValueProcessPipeline */
  public function testDefineValueProcessPipeline($method = 'defineValueProcessPipeline') {
    $this->plugin->$method($this->migration, 'field_name', []);

    

  }

  /** * {@inheritdoc} */
  public function defineValueProcessPipeline(MigrationInterface $migration$field_name$data) {
    $process = [
      'plugin' => 'd6_field_file',
      'source' => $field_name,
    ];
    $migration->mergeProcessOfProperty($field_name$process);
  }

  /** * {@inheritdoc} */
  public function getFieldType(Row $row) {
    return $row->getSourceProperty('widget_type') == 'imagefield_widget' ? 'image' : 'file';
  }

}
public function alterFieldInstanceMigration(MigrationInterface $migration) {
    $process = [
      'plugin' => 'static_map',
      'source' => 'settings/title',
      'bypass' => TRUE,
      'map' => [
        'disabled' => DRUPAL_DISABLED,
        'optional' => DRUPAL_OPTIONAL,
        'required' => DRUPAL_REQUIRED,
      ],
    ];
    $migration->mergeProcessOfProperty('settings/title', $process);
  }

}
    // relevant migrate message table.     if (!empty($field_data['settings']['todate'])) {
      $process['end_value'] = $process['value'];
      $process['end_value']['source'] = 'value2';
    }

    $process = [
      'plugin' => 'sub_process',
      'source' => $field_name,
      'process' => $process,
    ];
    $migration->mergeProcessOfProperty($field_name$process);
  }

  /** * {@inheritdoc} */
  public function getFieldType(Row $row) {
    $field_type = parent::getFieldType($row);

    // If the 'todate' setting is specified then change the field type to     // 'daterange' so we can migrate the end date.     if ($field_type === 'datetime' && !empty($row->get('settings/todate'))) {
      
Home | Imprint | This part of the site doesn't use cookies.