ImportText
in package
Use case for importing/creating texts.
Handles single text creation.
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- Constructor.
- execute() : array{message: string, textId: int|null}
- Create a new text.
- validateTextLength() : bool
- Validate text length (max 65000 bytes for MySQL TEXT column).
- removeSoftHyphens() : string
- Remove soft hyphens from text.
Properties
$textRepository
private
TextRepositoryInterface
$textRepository
Methods
__construct()
Constructor.
public
__construct(TextRepositoryInterface $textRepository) : mixed
Parameters
- $textRepository : TextRepositoryInterface
-
Text repository
execute()
Create a new text.
public
execute(int $languageId, string $title, string $text[, string $audioUri = '' ][, string $sourceUri = '' ]) : array{message: string, textId: int|null}
Parameters
- $languageId : int
-
Language ID
- $title : string
-
Title
- $text : string
-
Text content
- $audioUri : string = ''
-
Audio URI (optional)
- $sourceUri : string = ''
-
Source URI (optional)
Return values
array{message: string, textId: int|null}validateTextLength()
Validate text length (max 65000 bytes for MySQL TEXT column).
public
validateTextLength(string $text) : bool
Parameters
- $text : string
-
Text to validate
Return values
bool —True if valid, false if too long
removeSoftHyphens()
Remove soft hyphens from text.
private
removeSoftHyphens(string $text) : string
Parameters
- $text : string
-
Text to clean
Return values
string —Cleaned text