1 <?php
2 /* --------------------------------------------------------------
3 EmailRepositoryInterface.inc.php 2015-01-29 gm
4 Gambio GmbH
5 http://www.gambio.de
6 Copyright (c) 2015 Gambio GmbH
7 Released under the GNU General Public License (Version 2)
8 [http://www.gnu.org/licenses/gpl-2.0.html]
9 --------------------------------------------------------------
10 */
11
12 /**
13 * Interface EmailRepositoryInterface
14 *
15 * @category System
16 * @package Email
17 * @subpackage Interfaces
18 */
19 interface EmailRepositoryInterface
20 {
21 /**
22 * Writes an email record into the database.
23 *
24 * @param EmailInterface $email Contains the email information.
25 */
26 public function write(EmailInterface $email);
27
28
29 /**
30 * Returns an email record by ID.
31 *
32 * @param IdType $id Database ID of the record to be returned.
33 *
34 * @return EmailInterface Returns the email object that matches the ID.
35 */
36 public function getById(IdType $id);
37
38
39 /**
40 * Find email by ID
41 *
42 * This method will try to find the email record that matches provided ID and
43 * will return NULL on when the record does not exist.
44 *
45 * @param IdType $id Email record id to be found.
46 *
47 * @return EmailInterface|null Returns email object or null on failure.
48 */
49 public function findById(IdType $id);
50
51
52 /**
53 * Returns a collection of pending emails.
54 *
55 * @return EmailCollection Returns the pending email objects.
56 */
57 public function getPending();
58
59
60 /**
61 * Returns a collection of sent emails.
62 *
63 * @return EmailCollection Returns the sent email objects.
64 */
65 public function getSent();
66
67
68 /**
69 * Returns all email records from the database.
70 *
71 * @return EmailCollection Returns all email objects.
72 */
73 public function getAll();
74
75
76 /**
77 * Removes all information of an email record from the database.
78 *
79 * This method will remove ALL the email information, from the tables that
80 * contain information about the specified email.
81 *
82 * @param EmailInterface $email Contains the email information.
83 */
84 public function delete(EmailInterface $email);
85
86
87 /**
88 * Filter email records with provided keyword string.
89 *
90 * @param string $p_keyword String to be used for filtering the email records.
91 * @param array $limit (optional) Array that contains LIMIT and OFFSET value
92 * e.g. array( 'limit' => 10, 'offset' => 5 )
93 * @param array $order (optional) Contains arrays with column, direction pairs
94 * e.g. array( 'column' => 'direction' )
95 *
96 * @return EmailCollection Returns a collection containing the email records.
97 */
98 public function filter($p_keyword, array $limit = array(), array $order = array());
99
100
101 /**
102 * Get the current count of the email records in the database.
103 *
104 * @param string $p_filterKeyword (optional) If provided the records will be filtered.
105 *
106 * @return int Returns the row number of the email table.
107 */
108 public function getRecordCount($p_filterKeyword = '');
109 }