Class EmailReader
Reads email records from the database. This class provides a customizable interface for reading operations so that it is possible to build different variations in the EmailRepository class (e.g. "getPending", "findById", "getAll").
| category |
System |
|---|---|
| package |
|
| subpackage |
Repository |
__construct(\CI_DB_query_builder $db, \EmailFactoryInterface $factory)
\CI_DB_query_builderWill be used for database operations.
_createEmailByArray(array $emailDataArray) : \Email
This method expects the following values to be present in the array: 'email_id', 'subject', 'content', 'is_pending', 'contacts', 'attachments'. It uses the EmailFactory for creating email objects.
| Throws |
|
|---|
arrayContains the database record information.
\EmailReturns an object that represents the database record.
_filter(string $p_keyword)
This method will set the SQL filters depending the provided keyword so that one can "get" the filtered records.
| Throws |
|
|---|
stringFiltering keyword to be applied in the query.
_limit(array $rule)
Example: $this->_limit( array( 'limit' => 10, 'offset' => 0 ) );
| link |
http://www.codeigniter.com/userguide3/database/query_builder.html#limiting-or-counting-results |
|---|---|
arrayMust be an array that contains 'limit' and 'offset' values.
_order(array $rule)
Example: $this->_order( array( 'email_id' => 'desc' ) );
| link |
http://www.codeigniter.com/userguide3/database/query_builder.html#ordering-results |
|---|---|
arrayContains column, direction arrays for ordering results.
filter(string $p_keyword, array $limit = array(), array $order = array()) : \EmailCollection
stringString to be used for filtering the email records.
array(optional) Array that contains LIMIT and OFFSET value e.g. array( 'limit' => 10, 'offset' => 5 )
array(optional) Contains arrays with column, direction pairs e.g. array( 'column' => 'direction' )
\EmailCollectionReturns a collection containing the email records.
get(array $conditions = array(), array $limit = array(), array $order = array()) : \EmailCollection
Example: $reader->get(array('email_id' => $customerId), 10, array( array('email_id', 'asc') ));
array(optional) Contains conditions with column => value pairs.
array(optional) Array that contains LIMIT and OFFSET value e.g. array( 'limit' => 10, 'offset' => 5 )
array(optional) Contains arrays with column, direction pairs e.g. array( 'column' => 'direction' )
\EmailCollectionReturns a collection containing the email records.
getRecordCount(string $p_filterKeyword = '') : integer
This method will quickly return the record count of the "emails" table. It must be used when we just need the number and not the data, because the "get" or "find" methods need more time to load and parse the records.
| Throws |
|
|---|
string(optional) If provided the records will be filtered.
integerReturns the row number of the email table.
htmlentitiesWrapper( $string, $flags = false, $encoding = '', $doubleEncode = true)
htmlEntityDecodeWrapper( $string, $flags = false, $encoding = '')
db : \CI_DB_query_builder
| var |
|---|
\CI_DB_query_builder