public static function FlowPull::pullAll in CMS Content Sync 8
Same name and namespace in other branches
- 2.1.x src/Controller/FlowPull.php \Drupal\cms_content_sync\Controller\FlowPull::pullAll()
- 2.0.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 199
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'];
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;
}
$result[] = $pool
->getClient()
->getSyndicationService()
->pullAll($flow->id, $entity_type_name, $bundle_name)
->fromPool($pool->id)
->force($force);
}
}
return $result;
}