ListTexts
in package
Use case for listing texts with filtering and pagination.
Handles both active and archived text listing with support for language filtering, search queries, tag filters, and pagination.
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- Constructor.
- getArchivedTextCount() : int
- Get count of archived texts matching filters.
- getArchivedTextsList() : array<string|int, mixed>
- Get archived texts list with pagination.
- getArchivedTextsPerPage() : int
- Get archived texts per page setting.
- getPagination() : array{pages: int, currentPage: int, limit: string}
- Calculate pagination info.
- getTextCount() : int
- Get count of active texts matching filters.
- getTextsForLanguage() : array{items: array, total: int, page: int, per_page: int, total_pages: int}
- Get texts for a specific language with pagination.
- getTextsList() : array<string|int, mixed>
- Get active texts list with pagination.
- getTextsPerPage() : int
- Get texts per page setting.
Properties
$textRepository
private
TextRepositoryInterface
$textRepository
Methods
__construct()
Constructor.
public
__construct(TextRepositoryInterface $textRepository) : mixed
Parameters
- $textRepository : TextRepositoryInterface
-
Text repository
getArchivedTextCount()
Get count of archived texts matching filters.
public
getArchivedTextCount(string $whLang, string $whQuery, string $whTag) : int
Parameters
- $whLang : string
-
Language WHERE clause
- $whQuery : string
-
Query WHERE clause
- $whTag : string
-
Tag HAVING clause
Return values
int —Number of matching archived texts
getArchivedTextsList()
Get archived texts list with pagination.
public
getArchivedTextsList(string $whLang, string $whQuery, string $whTag, int $sort, int $page, int $perPage) : array<string|int, mixed>
Parameters
- $whLang : string
-
Language WHERE clause
- $whQuery : string
-
Query WHERE clause
- $whTag : string
-
Tag HAVING clause
- $sort : int
-
Sort index (1-based)
- $page : int
-
Page number (1-based)
- $perPage : int
-
Items per page
Return values
array<string|int, mixed> —Array of archived text records
getArchivedTextsPerPage()
Get archived texts per page setting.
public
getArchivedTextsPerPage() : int
Return values
int —Items per page
getPagination()
Calculate pagination info.
public
getPagination(int $totalCount, int $currentPage, int $perPage) : array{pages: int, currentPage: int, limit: string}
Parameters
- $totalCount : int
-
Total number of items
- $currentPage : int
-
Current page number
- $perPage : int
-
Items per page
Return values
array{pages: int, currentPage: int, limit: string}getTextCount()
Get count of active texts matching filters.
public
getTextCount(string $whLang, string $whQuery, string $whTag) : int
Parameters
- $whLang : string
-
Language WHERE clause
- $whQuery : string
-
Query WHERE clause
- $whTag : string
-
Tag HAVING clause
Return values
int —Number of matching texts
getTextsForLanguage()
Get texts for a specific language with pagination.
public
getTextsForLanguage(int $languageId[, int $page = 1 ][, int $perPage = 20 ]) : array{items: array, total: int, page: int, per_page: int, total_pages: int}
Parameters
- $languageId : int
-
Language ID
- $page : int = 1
-
Page number
- $perPage : int = 20
-
Items per page
Return values
array{items: array, total: int, page: int, per_page: int, total_pages: int}getTextsList()
Get active texts list with pagination.
public
getTextsList(string $whLang, string $whQuery, string $whTag, int $sort, int $page, int $perPage) : array<string|int, mixed>
Parameters
- $whLang : string
-
Language WHERE clause
- $whQuery : string
-
Query WHERE clause
- $whTag : string
-
Tag HAVING clause
- $sort : int
-
Sort index (1-based)
- $page : int
-
Page number (1-based)
- $perPage : int
-
Items per page
Return values
array<string|int, mixed> —Array of text records
getTextsPerPage()
Get texts per page setting.
public
getTextsPerPage() : int
Return values
int —Items per page