本文整理汇总了PHP中Drupal\migrate\MigrateExecutable::processRow方法的典型用法代码示例。如果您正苦于以下问题:PHP MigrateExecutable::processRow方法的具体用法?PHP MigrateExecutable::processRow怎么用?PHP MigrateExecutable::processRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\migrate\MigrateExecutable
的用法示例。
在下文中一共展示了MigrateExecutable::processRow方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadMultiple
/**
* {@inheritdoc}
*/
public function loadMultiple(EntityStorageInterface $storage, array $sub_ids = NULL)
{
/** @var \Drupal\migrate\Entity\MigrationInterface $bundle_migration */
$bundle_migration = $storage->load('d6_taxonomy_vocabulary');
$migrate_executable = new MigrateExecutable($bundle_migration, new MigrateMessage());
$process = array_intersect_key($bundle_migration->get('process'), $bundle_migration->getDestinationPlugin()->getIds());
$migrations = array();
$vid_map = array();
foreach ($bundle_migration->getIdMap() as $key => $value) {
$old_vid = unserialize($key)['sourceid1'];
$new_vid = $value['destid1'];
$vid_map[$old_vid] = $new_vid;
}
foreach ($bundle_migration->getSourcePlugin()->getIterator() as $source_row) {
$row = new Row($source_row, $source_row);
$migrate_executable->processRow($row, $process);
$old_vid = $source_row['vid'];
$new_vid = $row->getDestinationProperty('vid');
$vid_map[$old_vid] = $new_vid;
}
foreach ($vid_map as $old_vid => $new_vid) {
$values = $this->migration->toArray();
$migration_id = $this->migration->id() . ':' . $old_vid;
$values['id'] = $migration_id;
$values['source']['vid'] = $old_vid;
$values['process'][$new_vid] = 'tid';
$migrations[$migration_id] = $storage->create($values);
}
return $migrations;
}
示例2: getVocabularyIdMap
/**
* Builds a map of source vocabulary IDs to expected destination IDs.
*
* @param array $source
* Additional configuration for the d6_taxonomy_vocabulary source.
*
* @return array
* The vid map. The keys are the source IDs and the values are the
* (expected) destination IDs.
*/
protected function getVocabularyIdMap(array $source)
{
$map = [];
$template = $this->templateStorage->getTemplateByName('d6_taxonomy_vocabulary');
$template['source'] += $source;
$migration = Migration::create($template);
$executable = new MigrateExecutable($migration, new MigrateMessage());
// Only process the destination ID properties.
$process = array_intersect_key($template['process'], $migration->getDestinationPlugin()->getIds());
foreach ($migration->getSourcePlugin() as $source_row) {
// Process the row to generate the expected destination ID.
$executable->processRow($source_row, $process);
$map[$source_row->getSourceProperty('vid')] = $source_row->getDestinationProperty('vid');
}
return $map;
}
示例3: transformKey
/**
* Runs the process pipeline for the current key.
*
* @param string|int $key
* The current key.
* @param \Drupal\migrate\MigrateExecutable $migrate_executable
* The migrate executable helper class.
* @param \Drupal\migrate\Row $row
* The current row after processing.
*
* @return mixed
* The transformed key.
*/
protected function transformKey($key, MigrateExecutable $migrate_executable, Row $row)
{
$process = array('key' => $this->configuration['key']);
$migrate_executable->processRow($row, $process, $key);
return $row->getDestinationProperty('key');
}