Copied!

JobServiceInterface

JobServiceInterface.php : 33
Interface

Methods

publiccountBulkTranslationJobs()

JobServiceInterface.php : 58

Jobs pending removal are not counted.

public countBulkTranslationJobs([JobQuery|null $query = null ]) : int

Parameters

Name Type Default value Description
$query JobQuery|null null -

Return values

int

publiccreateBulkTranslationJob()

JobServiceInterface.php : 42

The active job check sees only the jobs committed before the call and takes no lock, so a parallel call can still create a second job for the same target language.

public createBulkTranslationJob(JobCreateStruct $createStruct) : Job

Parameters

Name Type Default value Description
$createStruct JobCreateStruct - -

Return values

Job

Tags
Throws
InvalidArgumentException
Throws
ActiveJobForTargetLanguageException

if one of the target languages already has a pending or in-progress job

publicfindBulkTranslationJobCreatorIds()

JobServiceInterface.php : 65

Leaves out creators whose only jobs are pending removal.

public findBulkTranslationJobCreatorIds() : array<int, int>

Return values

array<int, int>

publicfindBulkTranslationJobs()

JobServiceInterface.php : 53

Returns a page of jobs ordered newest first, together with the total number of matching jobs so a caller can paginate. Jobs pending removal are left out.

public findBulkTranslationJobs([JobQuery|null $query = null ]) : JobList

Parameters

Name Type Default value Description
$query JobQuery|null null -

Return values

JobList

publicfindBulkTranslationJobTargetLanguageCodes()

JobServiceInterface.php : 70
public findBulkTranslationJobTargetLanguageCodes() : array<int, string>

Return values

array<int, string>

publicfindJobItems()

JobServiceInterface.php : 75

Does not check whether the job is pending removal: load it with getBulkTranslationJob() first.

public findJobItems(JobItemQuery $query) : JobItemList

Parameters

Name Type Default value Description
$query JobItemQuery - -

Return values

JobItemList

publicgetBulkTranslationJob()

JobServiceInterface.php : 47
public getBulkTranslationJob(int $jobId) : Job

Parameters

Name Type Default value Description
$jobId int - -

Return values

Job

Tags
Throws
JobNotFoundException

if no job with the given ID exists or it is pending removal

publicremoveBulkTranslationJob()

JobServiceInterface.php : 125

Schedules the removal of a job of any status, optionally keeping the drafts of a partially created job. A pending or in-progress job is cancelled first; a finished job that is retranslating an item is removed as a whole and counts as partially created until that item finishes. Items whose content no longer exists are not checked.

public removeBulkTranslationJob(int $jobId, bool $keepDrafts) : void

Published translations stay in the content. Drafts the user may not remove, or whose removal fails, keep the job listed and are reported to the user.

Parameters

Name Type Default value Description
$jobId int - -
$keepDrafts bool - -
Tags
Throws
JobNotFoundException

if no job with the given ID exists or it is pending removal

Throws
InvalidJobRemovalException

if drafts were requested to be kept for a job that is not cancelled yet and whose items all completed

Throws
UnauthorizedException

if the current user may not edit the content of any item of the job, including content the user may not read, or has no content/versionremove policy at all when the drafts are not kept and the job still has a draft

publicretranslateJobItem()

JobServiceInterface.php : 146

Reruns the translation of a completed or failed job item. The job itself must be finished and idle (completed, for review or failed). The item's previous draft is removed once the new one is created.

public retranslateJobItem(int $jobItemId) : void

Parameters

Name Type Default value Description
$jobItemId int - -
Tags
Throws
JobItemNotFoundException

if no job item with the given ID exists or its job is pending removal

Throws
JobItemNotRetranslatableException
Throws
JobItemVersionRemovedException

if the job item is completed but its translated draft was deleted

Throws
JobItemPublishedVersionDeletedException

if the job item was published and its version was deleted afterwards

Throws
JobItemContentRemovedException

if the job item's content is in the trash

Throws
JobItemWithoutProviderException

if the job item was created without a translation provider

Throws
JobNotIdleException
Throws
ActiveJobForTargetLanguageException

if another job for one of the job's target languages is pending or in progress

Throws
UnauthorizedException

if the current user may not edit the job item's content in its target language, or may not remove the item's current draft

publicretryBulkTranslationJob()

JobServiceInterface.php : 109

Re-queues the failed items of the given bulk translation job for another translation attempt; already-completed items and failed items whose content is deleted or in the trash are left untouched.

public retryBulkTranslationJob(int $jobId) : void

Parameters

Name Type Default value Description
$jobId int - -
Tags
Throws
JobNotFoundException

if no job with the given ID exists or it is pending removal

Throws
JobNotRetryableException

if the job is not finished or has no failed items to retry

Throws
JobItemContentRemovedException

if the content of every failed item is deleted or in the trash

Throws
ActiveJobForTargetLanguageException

if another job for one of the job's target languages is pending or in progress

Throws
UnauthorizedException

if the current user may not edit, in its target language, the content of any item of the job whose content still exists, including when that content is not readable by the user

publicreviewBulkTranslationJobItems()

JobServiceInterface.php : 93

Applies an approve or reject review decision to the given bulk translation job items.

public reviewBulkTranslationJobItems(array<int, int> $jobItemIds, AutoTranslationReviewOperation $operation) : void

Parameters

Name Type Default value Description
$jobItemIds array<int, int> - -
$operation AutoTranslationReviewOperation - -
Tags
Throws
JobItemNotFoundException

if any of the given IDs does not exist, belongs to a job pending removal, or it has no associated auto-translation record

Throws
JobItemNotReviewableException

if any of the given job items is not currently awaiting review

Throws
JobItemVersionRemovedException

if any of the given job items is completed but its translated draft was deleted

Throws
JobItemPublishedVersionDeletedException

if any of the given job items was published and its version was deleted afterwards

Throws
JobItemContentRemovedException

if the content of any of the given job items is in the trash

Throws
UnauthorizedException

if the current user may not edit any of the given job items' content in its target language, including when that content is deleted or not readable by the user