diff --git a/src/Command/Backup/BackupCreateCommand.php b/src/Command/Backup/BackupCreateCommand.php
index 3f83c898b..338d943a3 100644
--- a/src/Command/Backup/BackupCreateCommand.php
+++ b/src/Command/Backup/BackupCreateCommand.php
@@ -65,7 +65,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
$live = $input->getOption('live') || $input->getOption('unsafe');
- $activity = $selectedEnvironment->backup($live);
+ $result = $selectedEnvironment->runOperation('backup', 'POST', ['safe' => !$live]);
+
+ // Hold the activities as a reference as they may be updated during
+ // waitMultiple() below, allowing the backup_name to be extracted.
+ $activities = $result->getActivities();
if ($live) {
$this->stdErr->writeln("Creating a live backup of $environmentId");
@@ -83,15 +87,17 @@ protected function execute(InputInterface $input, OutputInterface $output)
/** @var \Platformsh\Cli\Service\ActivityMonitor $activityMonitor */
$activityMonitor = $this->getService('activity_monitor');
- $success = $activityMonitor->waitAndLog($activity);
+ $success = $activityMonitor->waitMultiple($activities, $this->getSelectedProject());
if (!$success) {
return 1;
}
}
- if (!empty($activity['payload']['backup_name'])) {
- $name = $activity['payload']['backup_name'];
- $output->writeln("Backup name: $name");
+ foreach ($activities as $activity) {
+ if ($activity->type === 'environment.backup' && !empty($activity->payload['backup_name'])) {
+ $output->writeln(\sprintf('Backup name: %s', $activity->payload['backup_name']));
+ break;
+ }
}
return 0;