public function CreateStatusEntities::prepare in CMS Content Sync 8
Same name and namespace in other branches
- 2.1.x modules/cms_content_sync_migrate_acquia_content_hub/src/CreateStatusEntities.php \Drupal\cms_content_sync_migrate_acquia_content_hub\CreateStatusEntities::prepare()
- 2.0.x modules/cms_content_sync_migrate_acquia_content_hub/src/CreateStatusEntities.php \Drupal\cms_content_sync_migrate_acquia_content_hub\CreateStatusEntities::prepare()
Collect relevant nodes.
Parameters
$flow_id:
$flow_configurations:
$pools:
$type:
bool $execute:
File
- modules/
cms_content_sync_migrate_acquia_content_hub/ src/ CreateStatusEntities.php, line 25
Class
Namespace
Drupal\cms_content_sync_migrate_acquia_content_hubCode
public function prepare($flow_id, $flow_configurations, $pool_id, $type, $tags = '') {
$operations = [];
if ($type == 'push') {
foreach ($flow_configurations as $type => $type_config) {
foreach ($type_config as $bundle => $bundle_config) {
if ($bundle_config['push_configuration']['behavior'] != PushIntent::PUSH_AUTOMATICALLY) {
continue;
}
$entity_type = \Drupal::entityTypeManager()
->getDefinition($type);
$ids = \Drupal::entityQuery($type)
->condition($entity_type
->getKey('bundle'), $bundle)
->execute();
foreach ($ids as $id) {
$operations[] = [
__NAMESPACE__ . '\\CreateStatusEntities::execute',
[
$type,
$id,
$flow_id,
$pool_id,
'push',
],
];
}
}
}
return $operations;
}
$tags = MigrationBase::getTermsFromFilter($tags);
if (empty($tags)) {
return $operations;
}
$ids = [];
foreach ($tags as $tag) {
$ids[] = $tag
->id();
}
$query = \Drupal::database()
->select('taxonomy_index', 'ti');
$query
->fields('ti', [
'nid',
]);
$query
->condition('ti.tid', $ids, 'IN');
$result = $query
->execute()
->fetchCol();
foreach ($result as $nid) {
$operations[] = [
__NAMESPACE__ . '\\CreateStatusEntities::execute',
[
'node',
$nid,
$flow_id,
$pool_id,
'pull',
],
];
}
return $operations;
}