phpDocumentor

EmailRepository
in package
implements EmailRepositoryInterface

Class EmailRepository

Handles the database operations that concern the email records of the database. It provides a layer for more complicated methods that use the writer, reader and deleter.

Tags
category

System

subpackage

Repository

Interfaces, Classes and Traits

EmailRepositoryInterface
Interface EmailRepositoryInterface

Table of Contents

$deleter  : EmailDeleterInterface
E-Mail deleter.
$reader  : EmailReaderInterface
E-Mail reader.
$writer  : EmailWriterInterface
E-Mail writer.
__construct()  : mixed
Class Constructor
delete()  : mixed
Removes all information of an email record from the database.
deleteEmailsByEmailAddress()  : mixed
Removes all emails from the data base that have the given email address as sender or recipient.
deleteOldEmailsByDate()  : mixed
Deletes all emails that have creation date below the give date.
filter()  : EmailCollection
Filter email records with provided keyword string.
findById()  : EmailInterface|null
Find email by ID
getAll()  : EmailCollection
Returns all email records from the database.
getById()  : EmailInterface
Returns an email record by ID.
getEmailsByEmailAddress()  : EmailCollection
Gets all emails from the data base that have the given email address as sender or recipient.
getPending()  : EmailCollection
Returns a collection of pending emails.
getRecordCount()  : int
Get the current count of the email records in the database.
getSent()  : EmailCollection
Returns a collection of sent emails.
write()  : mixed
Writes an email record into the database.

Properties

Methods

delete()

Removes all information of an email record from the database.

public delete(EmailInterface $email) : mixed

This method will remove ALL the email information, from the tables that contain information about the specified email.

Parameters
$email : EmailInterface

Contains the email information.

Return values
mixed

deleteEmailsByEmailAddress()

Removes all emails from the data base that have the given email address as sender or recipient.

public deleteEmailsByEmailAddress(CustomerEmail $email) : mixed
Parameters
$email : CustomerEmail

E-Mail address.

Return values
mixed

deleteOldEmailsByDate()

Deletes all emails that have creation date below the give date.

public deleteOldEmailsByDate(DateTime $date) : mixed
Parameters
$date : DateTime
Return values
mixed

filter()

Filter email records with provided keyword string.

public filter(string $p_keyword[, array<string|int, mixed> $limit = [] ][, array<string|int, mixed> $order = [] ]) : EmailCollection
Parameters
$p_keyword : string

String to be used for filtering the email records.

$limit : array<string|int, mixed> = []

(optional) Array that contains LIMIT and OFFSET value e.g. array( 'limit' => 10, 'offset' => 5 )

$order : array<string|int, mixed> = []

(optional) Contains arrays with column, direction pairs e.g. array( 'column' => 'direction' )

Return values
EmailCollection

Returns a collection containing the email records.

findById()

Find email by ID

public findById(IdType $id) : EmailInterface|null

This method will try to find the email record that matches provided ID and will return NULL on when the record does not exist.

Parameters
$id : IdType

Email record id to be found.

Return values
EmailInterface|null

Returns email object or null on failure.

getById()

Returns an email record by ID.

public getById(IdType $id) : EmailInterface
Parameters
$id : IdType

Database ID of the record to be returned.

Tags
throws
UnexpectedValueException

If record does not exist.

Return values
EmailInterface

Returns the email object that matches the ID.

getRecordCount()

Get the current count of the email records in the database.

public getRecordCount([string $p_filterKeyword = '' ]) : int
Parameters
$p_filterKeyword : string = ''

(optional) If provided the records will be filtered.

Return values
int

Returns the row number of the email table.

Search results