public function CliService::sync in Apigee Edge 8
Handle the sync interaction.
Parameters
\Symfony\Component\Console\Style\StyleInterface $io: The IO interface of the CLI tool calling the method.
callable $t: The translation function akin to t().
Overrides CliServiceInterface::sync
File
- src/
CliService.php, line 51
Class
- CliService
- A CLI service which defines all the commands logic and delegates the methods.
Namespace
Drupal\apigee_edgeCode
public function sync(StyleInterface $io, callable $t) {
$io
->title($t('Developer - User synchronization'));
$batch = DeveloperSyncController::getBatch();
$last_message = '';
foreach ($batch['operations'] as $operation) {
$context = [
'finished' => 0,
];
while ($context['finished'] < 1) {
call_user_func_array($operation[0], array_merge($operation[1], [
&$context,
]));
if (isset($context['message']) && $context['message'] !== $last_message) {
$io
->text($t($context['message']));
}
$last_message = $context['message'];
gc_collect_cycles();
}
}
}