PDOQuoteRepository
in package
implements
QuoteRepositoryInterface
Read onlyYes
Tags
Table of Contents
Interfaces
- QuoteRepositoryInterface
- Describes behavior of quote repository
Properties
- $DATE_FORMAT : string
- $dbHelper : DatabaseService
- $TABLE_NAME : string
Methods
- __construct() : mixed
- add() : int
- Persists a new quote entity.
- fetchLatestQuote() : Quote|null
- Fetches the latest quote for today.
- mapRow() : Quote
- Maps database row to Quote 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 quote entity.
public
add(Quote $quote) : int
Parameters
- $quote : Quote
-
The quote entity to add
Tags
Return values
int —id
fetchLatestQuote()
Fetches the latest quote for today.
public
fetchLatestQuote() : Quote|null
Tags
Return values
Quote|null —The latest quote for today or null if none exists
mapRow()
Maps database row to Quote entity.
private
mapRow(array<string|int, mixed> $row) : Quote
Parameters
- $row : array<string|int, mixed>