Overview
  • Package
  • Class
  • Tree
  • Todo

Packages

  • AddonValue
    • Interfaces
  • ApiV2Controllers
  • Category
    • Collections
    • Entities
    • Factories
    • Interfaces
    • Providers
    • Repositories
    • Storages
  • Customer
    • Address
    • Country
    • CountryZone
    • Interfaces
    • Validation
    • ValueObjects
  • Email
    • Collections
    • Entities
    • Exceptions
    • Interfaces
    • Repository
    • ValueObjects
  • Http
    • Collections
    • Exceptions
    • Factories
    • Interfaces
    • ValueObjects
  • Loaders
    • CrossCuttingLoader
    • GXCoreLoader
    • Interfaces
  • None
  • Order
    • Collections
    • Entities
    • Factories
    • Interfaces
    • Repositories
    • Storages
    • ValueObjects
  • Product
    • Collections
    • Entities
    • Factories
    • Interfaces
    • Providers
    • Repositories
    • Storages
  • ProductModule
    • Collections
    • Deleter
    • Entities
    • Factories
    • Interface
    • Interfaces
    • Reader
    • Repositories
    • Writer
  • Shared
    • Exceptions
    • FileSystem
    • Interfaces
    • Storage
    • Types
  • Statistics
    • Interfaces
  • UserConfiguration
    • Interfaces
    • Repository

Classes

  • EmailDeleter
  • EmailReader
  • EmailRepository
  • EmailWriter

Class EmailReader

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").

EmailReader implements EmailReaderInterface
Package: Email\Repository
Category: System
Located at SystemServices/Email/Repositories/EmailReader.inc.php

Methods summary

public
# __construct( CI_DB_query_builder $db, EmailFactoryInterface $factory )

Class Constructor

Class Constructor

Parameters

$db
Will be used for database operations.
$factory
Will be used for the creation of returned objects.
public EmailCollection
# get( array $conditions = array(), array $limit = array(), array $order = array() )

Get email records filtered by conditions.

Get email records filtered by conditions.

Example: $reader->get(array('email_id' => $customerId), 10, array( array('email_id', 'asc') ));

Parameters

$conditions
(optional) Contains conditions with column => value pairs.
$limit

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

$order

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

Returns

EmailCollection
Returns a collection containing the email records.

Implementation of

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

Filter email records with provided keyword string.

Filter email records with provided keyword string.

Parameters

$p_keyword
String to be used for filtering the email records.
$limit

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

$order

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

Returns

EmailCollection
Returns a collection containing the email records.

Implementation of

EmailReaderInterface::filter()
public integer
# getRecordCount( string $p_filterKeyword = '' )

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

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

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.

Parameters

$p_filterKeyword
(optional) If provided the records will be filtered.

Returns

integer
Returns the row number of the email table.

Throws

InvalidArgumentException
If the provided argument is not a string.

Implementation of

EmailReaderInterface::getRecordCount()
protected Email
# _createEmailByArray( array $emailDataArray )

Creates an email object out of an array.

Creates an email object out of an array.

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.

Parameters

$emailDataArray
Contains the database record information.

Returns

Email
Returns an object that represents the database record.

Throws

UnexpectedValueException
If the 'creation_date' of the email is empty.
protected
# _filter( string $p_keyword )

Apply filter rules to email records.

Apply filter rules to email records.

This method will set the SQL filters depending the provided keyword so that one can "get" the filtered records.

Parameters

$p_keyword
Filtering keyword to be applied in the query.

Throws

InvalidArgumentException
If the $keyword argument is not a string.
protected
# _limit( array $rule )

Apply LIMIT clause to query.

Apply LIMIT clause to query.

Example: $this->_limit( array( 'limit' => 10, 'offset' => 0 ) );

Parameters

$rule
Must be an array that contains 'limit' and 'offset' values.

Link

http://www.codeigniter.com/userguide3/database/query_builder.html#limiting-or-counting-results
protected
# _order( array $rule )

Apply ORDER BY clause to query.

Apply ORDER BY clause to query.

Example: $this->_order( array( 'email_id' => 'desc' ) );

Parameters

$rule
Contains column, direction arrays for ordering results.

Link

http://www.codeigniter.com/userguide3/database/query_builder.html#ordering-results

Properties summary

protected CI_DB_query_builder $db

Query builder.

Query builder.

#
protected EmailFactory $factory

E-Mail factory.

E-Mail factory.

#
API documentation generated by ApiGen