Skip to content

Commit

Permalink
Fix GUI CSV Actor export for translations. (#1752)
Browse files Browse the repository at this point in the history
  • Loading branch information
melaniekung committed Feb 14, 2024
1 parent 98ac06a commit 712c8ff
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion lib/job/arActorExportJob.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,33 @@ protected function doExport($path)
return;
}

$this->exportResource($resource, $path);
$this->csvActionExport($path, $resource);
$this->logExportProgress();
}
}

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

// Prepare CSV exporter
$writer = new csvActorExport($path);
$writer->setOptions(['relations' => true]);

// Export actors 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) {
$actor = QubitActor::getById($resource->id);
$this->context->getUser()->setCulture($culture);

$writer->exportResource($actor);

++$itemsExported;
}
}
}

0 comments on commit 712c8ff

Please sign in to comment.