Documentation

UpdateText

Use case for updating texts.

Handles updates to both active and archived texts, including reparsing when text content changes.

Tags
since
3.0.0

Table of Contents

Methods

execute()  : array{updated: bool, reparsed: bool}
Update an active text.
formatArchivedUpdateMessage()  : string
Format archived text update result as a user-facing message.
formatRebuildMessage()  : string
Format rebuild result as a user-facing message.
formatUpdateMessage()  : string
Format update result as a user-facing message.
rebuildTexts()  : int
Rebuild/reparse multiple texts.
saveTextAndReparse()  : string
Save text and reparse (alias for execute with reparse).
updateArchivedText()  : int
Update an archived text.
removeSoftHyphens()  : string
Remove soft hyphens from text.
reparseText()  : void
Reparse a text (delete old parsed data and parse again).

Methods

execute()

Update an active text.

public execute(int $textId, int $languageId, string $title, string $text, string $audioUri, string $sourceUri) : array{updated: bool, reparsed: bool}
Parameters
$textId : int

Text ID

$languageId : int

Language ID

$title : string

Title

$text : string

Text content

$audioUri : string

Audio URI

$sourceUri : string

Source URI

Return values
array{updated: bool, reparsed: bool}

formatArchivedUpdateMessage()

Format archived text update result as a user-facing message.

public static formatArchivedUpdateMessage(int $affectedCount) : string
Parameters
$affectedCount : int

Number of rows affected

Return values
string

Formatted message

formatRebuildMessage()

Format rebuild result as a user-facing message.

public static formatRebuildMessage(int $count) : string
Parameters
$count : int

Number of texts rebuilt

Return values
string

Formatted message

formatUpdateMessage()

Format update result as a user-facing message.

public static formatUpdateMessage(bool $updated, bool $reparsed) : string
Parameters
$updated : bool

Whether the text was updated

$reparsed : bool

Whether the text was reparsed

Return values
string

Formatted message

rebuildTexts()

Rebuild/reparse multiple texts.

public rebuildTexts(array<string|int, mixed> $textIds) : int
Parameters
$textIds : array<string|int, mixed>

Array of text IDs

Return values
int

Number of texts rebuilt

saveTextAndReparse()

Save text and reparse (alias for execute with reparse).

public saveTextAndReparse(int $textId, int $languageId, string $title, string $text, string $audioUri, string $sourceUri) : string
Parameters
$textId : int

Text ID

$languageId : int

Language ID

$title : string

Title

$text : string

Text content

$audioUri : string

Audio URI

$sourceUri : string

Source URI

Return values
string

Result message

updateArchivedText()

Update an archived text.

public updateArchivedText(int $textId, int $languageId, string $title, string $text, string $audioUri, string $sourceUri) : int
Parameters
$textId : int

Archived text ID

$languageId : int

Language ID

$title : string

Title

$text : string

Text content

$audioUri : string

Audio URI

$sourceUri : string

Source URI

Return values
int

Number of rows affected

removeSoftHyphens()

Remove soft hyphens from text.

private removeSoftHyphens(string $text) : string
Parameters
$text : string

Text to clean

Return values
string

Cleaned text

reparseText()

Reparse a text (delete old parsed data and parse again).

private reparseText(int $textId, int $languageId, string $text) : void
Parameters
$textId : int

Text ID

$languageId : int

Language ID

$text : string

Text content


        
On this page

Search results