public function ProductType::prepareRow in Commerce Migrate 8.2
Same name and namespace in other branches
- 3.1.x modules/commerce/src/Plugin/migrate/source/commerce1/ProductType.php \Drupal\commerce_migrate_commerce\Plugin\migrate\source\commerce1\ProductType::prepareRow()
- 3.0.x modules/commerce/src/Plugin/migrate/source/commerce1/ProductType.php \Drupal\commerce_migrate_commerce\Plugin\migrate\source\commerce1\ProductType::prepareRow()
Adds additional data to the row.
Parameters
\Drupal\migrate\Row $row: The row object.
Return value
bool FALSE if this row needs to be skipped.
Overrides SourcePluginBase::prepareRow
File
- modules/
commerce/ src/ Plugin/ migrate/ source/ commerce1/ ProductType.php, line 44
Class
- ProductType
- Gets Commerce 1 commerce_product_type data from database.
Namespace
Drupal\commerce_migrate_commerce\Plugin\migrate\source\commerce1Code
public function prepareRow(Row $row) {
// Add the line item type for this product type, if it exists.
$type = $row
->getSourceProperty('type');
$data = $this
->select('field_config_instance', 'fci')
->fields('fci', [
'data',
])
->condition('fci.bundle', $type)
->condition('data', '%line_item_type%', 'LIKE')
->execute()
->fetchCol();
$data = empty($data) ?: unserialize($data[0]);
$line_item_type = isset($data['display']['default']['settings']['line_item_type']) ? $data['display']['default']['settings']['line_item_type'] : '';
$row
->setSourceProperty('line_item_type', $line_item_type);
return parent::prepareRow($row);
}