Class EmailRepository

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.

EmailRepository implements EmailRepositoryInterface

Methods summary

public __construct( EmailWriterInterface $writer, EmailReaderInterface $reader, EmailDeleterInterface $deleter )

Class Constructor

public write( EmailInterface $email )

Writes an email record into the database.

public getById( IdType $id ) : EmailInterface

Returns an email record by ID.

public findById( IdType $id ) : EmailInterface|null

Find email by ID

public getPending( void ) : EmailCollection

Returns a collection of pending emails.

public getSent( void ) : EmailCollection

Returns a collection of sent emails.

public getAll( void ) : EmailCollection

Returns all email records from the database.

public delete( EmailInterface $email )

Removes all information of an email record from the database.

public filter( string $p_keyword, array $limit = array(), array $order = array() ) : EmailCollection

Filter email records with provided keyword string.

public getRecordCount( string $p_filterKeyword = '' ) : integer

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

public deleteEmailsByEmailAddress( CustomerEmail $email )

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

public getEmailsByEmailAddress( CustomerEmail $email ) : EmailCollection

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

Properties summary

protected $writer : EmailWriterInterface

E-Mail writer.


		
protected $reader : EmailReaderInterface

E-Mail reader.


		
protected $deleter : EmailDeleterInterface

E-Mail deleter.