PDOWordRepository
in package
implements
WordRepositoryInterface
Read onlyYes
Tags
Table of Contents
Interfaces
- WordRepositoryInterface
- Describes behavior of the word repository
Properties
- $DATE_FORMAT : string
- $dbHelper : DatabaseService
- $TABLE_NAME : string
Methods
- __construct() : mixed
- add() : bool
- Persists a new word entity.
- fetchLatestWord() : Word|null
- Fetches the latest word for today.
- mapRow() : Word
- Maps database row to Word entity.
Properties
$DATE_FORMAT
private
string
$DATE_FORMAT
$dbHelper
private
DatabaseService
$dbHelper
$TABLE_NAME
private
string
$TABLE_NAME
Methods
__construct()
public
__construct(DatabaseService $dbHelper, string $TABLE_NAME, string $DATE_FORMAT) : mixed
Parameters
- $dbHelper : DatabaseService
- $TABLE_NAME : string
- $DATE_FORMAT : string
add()
Persists a new word entity.
public
add(Word $word) : bool
Parameters
- $word : Word
-
The word entity to add
Tags
Return values
bool —True if insertion was successful, false otherwise
fetchLatestWord()
Fetches the latest word for today.
public
fetchLatestWord() : Word|null
Tags
Return values
Word|null —The latest word for today or null if none exists
mapRow()
Maps database row to Word entity.
private
mapRow(array<string|int, mixed> $row) : Word
Parameters
- $row : array<string|int, mixed>