public static function FlowPull::pullAll in CMS Content Sync 2.0.x
Same name and namespace in other branches
- 8 src/Controller/FlowPull.php \Drupal\cms_content_sync\Controller\FlowPull::pullAll()
- 2.1.x src/Controller/FlowPull.php \Drupal\cms_content_sync\Controller\FlowPull::pullAll()
Kindly ask the Sync Core to pull all entities that are auto pulled.
Parameters
\Drupal\cms_content_sync\Entity\Flow $flow:
bool $force:
Return value
\EdgeBox\SyncCore\Interfaces\Syndication\IPullAll[]
3 calls to FlowPull::pullAll()
- CliService::pull in src/
Cli/ CliService.php - Kindly ask the Sync Core to pull all entities for a specific flow, or to force pull one specific entity.
- CliService::pull_entities in src/
Cli/ CliService.php - Kindly ask the Sync Core to pull all entities for a specific flow.
- FlowPull::pull in src/
Controller/ FlowPull.php - Pull all entities of this Flow.
File
- src/
Controller/ FlowPull.php, line 200
Class
- FlowPull
- Pull controller.
Namespace
Drupal\cms_content_sync\ControllerCode
public static function pullAll($flow, $force = false) {
$flow_import = $force ? [
PullIntent::PULL_AUTOMATICALLY,
] : [
PullIntent::PULL_AUTOMATICALLY,
PullIntent::PULL_MANUALLY,
];
$pool_import = $force ? [
Pool::POOL_USAGE_FORCE,
] : [
Pool::POOL_USAGE_FORCE,
Pool::POOL_USAGE_ALLOW,
];
/**
* @var \EdgeBox\SyncCore\Interfaces\Syndication\IPullAll[] $result
*/
$result = [];
$pools = Pool::getAll();
foreach ($flow
->getEntityTypeConfig() as $id => $type) {
$entity_type_name = $type['entity_type_name'];
$bundle_name = $type['bundle_name'];
$version = $type['version'];
if (Flow::HANDLER_IGNORE == $type['handler']) {
continue;
}
if (!in_array($type['import'], $flow_import)) {
continue;
}
$entity_type_pools = [];
if (isset($type['import_pools'])) {
foreach ($type['import_pools'] as $pool_id => $state) {
if (!isset($entity_type_pools[$pool_id])) {
$entity_type_pools[$pool_id] = [];
}
$entity_type_pools[$pool_id]['import'] = $state;
}
}
foreach ($entity_type_pools as $pool_id => $definition) {
if (empty($pools[$pool_id])) {
continue;
}
$pool = $pools[$pool_id];
$import = $definition['import'] ?? null;
if (!in_array($import, $pool_import)) {
continue;
}
$client = $pool
->getClient();
if ($client
->featureEnabled(ISyncCore::FEATURE_PULL_ALL_WITHOUT_POOL)) {
$result[] = $client
->getSyndicationService()
->pullAll($flow->id, $entity_type_name, $bundle_name, $version)
->force($force);
break;
}
$result[] = $client
->getSyndicationService()
->pullAll($flow->id, $entity_type_name, $bundle_name, $version)
->fromPool($pool->id)
->force($force);
}
}
return $result;
}