Skip to content

Commit

Permalink
Fix GUI CSV Repo export for translations. (#1755)
Browse files Browse the repository at this point in the history
  • Loading branch information
melaniekung committed Mar 14, 2024
1 parent 80bc661 commit e932f1b
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions lib/job/arRepositoryCsvExportJob.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,36 @@ protected function exportResults($path)
return -1;
}

$itemsExported = $this->csvActionExport($resource, $writer);
}

return $itemsExported;
}

protected function csvActionExport($resource, $writer)
{
$configuration = ProjectConfiguration::getApplicationConfiguration('qubit', 'prod', false);
$this->context = sfContext::createInstance($configuration);

// Export repositories and, optionally, related data
$itemsExported = 0;

$cultures = array_keys(DefaultTranslationLinksComponent::getOtherCulturesAvailable($resource->actorI18ns, 'authorizedFormOfName', $resource->getAuthorizedFormOfName(['sourceCulture' => true])));

// Write row to file and initialize row
foreach ($cultures as $culture) {
$this->context->getUser()->setCulture($culture);

$writer->exportResource($resource);

// Log progress every 1000 rows
if ($itemsExported && (0 == $itemsExported % 1000)) {
$this->info($this->i18n->__('%1 items exported.', ['%1' => $itemsExported]));
}

++$itemsExported;
}

++$itemsExported;

return $itemsExported;
}
}

0 comments on commit e932f1b

Please sign in to comment.