Commit 46e8fc7f authored by Dan Flanagan's avatar Dan Flanagan Committed by Dan Flanagan
Browse files

Issue #3275329 by danflanagan8: if_condition cannot use destination existing values

parent 2a97e1b7
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -178,9 +178,8 @@ class IfCondition extends ProcessPluginWithConditionBase {
    elseif (!isset($conditional_process[$destination_property]['source']) && isset($this->configuration['source'])) {
      $conditional_process[$destination_property]['source'] = $this->configuration['source'];
    }
    $new_row = new Row($row->getSource());
    $migrate_executable->processRow($new_row, $conditional_process);
    return $new_row->getDestinationProperty($destination_property);
    $migrate_executable->processRow($row, $conditional_process);
    return $row->getDestinationProperty($destination_property);
  }

}
+18 −0
Original line number Diff line number Diff line
@@ -101,6 +101,22 @@ class IfConditionTest extends KernelTestBase {
            'callable' => 'strtoupper',
          ],
        ],
        'dest_value_4' => [
          'plugin' => 'if_condition',
          'source' => 'my_source',
          'condition' => [
            'plugin' => 'contains',
            'value' => 'migrate',
          ],
          'do_process' => [
            'plugin' => 'get',
            'source' => '@dest_value_3',
          ],
          'else_process' => [
            'plugin' => 'get',
            'source' => '@dest_value_2',
          ],
        ],
      ],
      'destination' => [
        'plugin' => 'config',
@@ -150,6 +166,7 @@ class IfConditionTest extends KernelTestBase {
          'dest_value_1' => 'HI, FRIEND.',
          'dest_value_2' => 'hamburger',
          'dest_value_3' => 'This is a test',
          'dest_value_4' => 'hamburger',
        ],
      ],
      [
@@ -165,6 +182,7 @@ class IfConditionTest extends KernelTestBase {
          ],
          'dest_value_2' => 'HI, FRIEND.',
          'dest_value_3' => 'THIS MAKES MIGRATE FUN',
          'dest_value_4' => 'THIS MAKES MIGRATE FUN',
        ],
      ],
    ];