You are here

protected function PrepareRow::setEntityType in Commerce Migrate 3.0.x

Same name and namespace in other branches
  1. 8.2 modules/ubercart/src/EventSubscriber/PrepareRow.php \Drupal\commerce_migrate_ubercart\EventSubscriber\PrepareRow::setEntityType()
  2. 3.1.x modules/ubercart/src/EventSubscriber/PrepareRow.php \Drupal\commerce_migrate_ubercart\EventSubscriber\PrepareRow::setEntityType()

Helper to set the correct entity type in the source row.

Parameters

\Drupal\migrate\Row $row: The row object.

\Drupal\migrate\Plugin\MigrationInterface $migration: The migration.

string $type_name: The type name.

1 call to PrepareRow::setEntityType()
PrepareRow::onPrepareRow in modules/ubercart/src/EventSubscriber/PrepareRow.php
Responds to prepare row event.

File

modules/ubercart/src/EventSubscriber/PrepareRow.php, line 196

Class

PrepareRow
Handles migrate_plus prepare row event.

Namespace

Drupal\commerce_migrate_ubercart\EventSubscriber

Code

protected function setEntityType(Row $row, MigrationInterface $migration, $type_name) {
  if ($this->productTypes == []) {
    $this->productTypes = $this
      ->getProductTypes($migration);
  }
  if (in_array($type_name, $this->productTypes)) {
    $row
      ->setSourceProperty('entity_type', 'commerce_product');
    return TRUE;
  }
  return FALSE;
}