DAOs with singular/plural options for entity titles
[civicrm-core.git] / CRM / Mailing / Event / DAO / Forward.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Mailing/Event/Forward.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:16bd96b998ed8316250158886d0dc7c8)
10 */
11
12 /**
13 * Database access object for the Forward entity.
14 */
15 class CRM_Mailing_Event_DAO_Forward extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_mailing_event_forward';
25
26 /**
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
28 *
29 * @var bool
30 */
31 public static $_log = FALSE;
32
33 /**
34 * @var int
35 */
36 public $id;
37
38 /**
39 * FK to EventQueue
40 *
41 * @var int
42 */
43 public $event_queue_id;
44
45 /**
46 * FK to EventQueue for destination
47 *
48 * @var int
49 */
50 public $dest_queue_id;
51
52 /**
53 * When this forward event occurred.
54 *
55 * @var timestamp
56 */
57 public $time_stamp;
58
59 /**
60 * Class constructor.
61 */
62 public function __construct() {
63 $this->__table = 'civicrm_mailing_event_forward';
64 parent::__construct();
65 }
66
67 /**
68 * Returns localized title of this entity.
69 *
70 * @param bool $plural
71 * Whether to return the plural version of the title.
72 */
73 public static function getEntityTitle($plural = FALSE) {
74 return $plural ? ts('Forwards') : ts('Forward');
75 }
76
77 /**
78 * Returns foreign keys and entity references.
79 *
80 * @return array
81 * [CRM_Core_Reference_Interface]
82 */
83 public static function getReferenceColumns() {
84 if (!isset(Civi::$statics[__CLASS__]['links'])) {
85 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
86 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'event_queue_id', 'civicrm_mailing_event_queue', 'id');
87 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'dest_queue_id', 'civicrm_mailing_event_queue', 'id');
88 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
89 }
90 return Civi::$statics[__CLASS__]['links'];
91 }
92
93 /**
94 * Returns all the column names of this table
95 *
96 * @return array
97 */
98 public static function &fields() {
99 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
100 Civi::$statics[__CLASS__]['fields'] = [
101 'id' => [
102 'name' => 'id',
103 'type' => CRM_Utils_Type::T_INT,
104 'title' => ts('Forward ID'),
105 'required' => TRUE,
106 'where' => 'civicrm_mailing_event_forward.id',
107 'table_name' => 'civicrm_mailing_event_forward',
108 'entity' => 'Forward',
109 'bao' => 'CRM_Mailing_Event_BAO_Forward',
110 'localizable' => 0,
111 'add' => NULL,
112 ],
113 'event_queue_id' => [
114 'name' => 'event_queue_id',
115 'type' => CRM_Utils_Type::T_INT,
116 'title' => ts('Mailing Event Queue'),
117 'description' => ts('FK to EventQueue'),
118 'required' => TRUE,
119 'where' => 'civicrm_mailing_event_forward.event_queue_id',
120 'table_name' => 'civicrm_mailing_event_forward',
121 'entity' => 'Forward',
122 'bao' => 'CRM_Mailing_Event_BAO_Forward',
123 'localizable' => 0,
124 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue',
125 'add' => NULL,
126 ],
127 'dest_queue_id' => [
128 'name' => 'dest_queue_id',
129 'type' => CRM_Utils_Type::T_INT,
130 'title' => ts('Destination Queue'),
131 'description' => ts('FK to EventQueue for destination'),
132 'where' => 'civicrm_mailing_event_forward.dest_queue_id',
133 'table_name' => 'civicrm_mailing_event_forward',
134 'entity' => 'Forward',
135 'bao' => 'CRM_Mailing_Event_BAO_Forward',
136 'localizable' => 0,
137 'FKClassName' => 'CRM_Mailing_Event_DAO_Queue',
138 'add' => NULL,
139 ],
140 'time_stamp' => [
141 'name' => 'time_stamp',
142 'type' => CRM_Utils_Type::T_TIMESTAMP,
143 'title' => ts('Timestamp'),
144 'description' => ts('When this forward event occurred.'),
145 'required' => TRUE,
146 'where' => 'civicrm_mailing_event_forward.time_stamp',
147 'default' => 'CURRENT_TIMESTAMP',
148 'table_name' => 'civicrm_mailing_event_forward',
149 'entity' => 'Forward',
150 'bao' => 'CRM_Mailing_Event_BAO_Forward',
151 'localizable' => 0,
152 'add' => NULL,
153 ],
154 ];
155 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
156 }
157 return Civi::$statics[__CLASS__]['fields'];
158 }
159
160 /**
161 * Return a mapping from field-name to the corresponding key (as used in fields()).
162 *
163 * @return array
164 * Array(string $name => string $uniqueName).
165 */
166 public static function &fieldKeys() {
167 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
168 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
169 }
170 return Civi::$statics[__CLASS__]['fieldKeys'];
171 }
172
173 /**
174 * Returns the names of this table
175 *
176 * @return string
177 */
178 public static function getTableName() {
179 return self::$_tableName;
180 }
181
182 /**
183 * Returns if this table needs to be logged
184 *
185 * @return bool
186 */
187 public function getLog() {
188 return self::$_log;
189 }
190
191 /**
192 * Returns the list of fields that can be imported
193 *
194 * @param bool $prefix
195 *
196 * @return array
197 */
198 public static function &import($prefix = FALSE) {
199 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_forward', $prefix, []);
200 return $r;
201 }
202
203 /**
204 * Returns the list of fields that can be exported
205 *
206 * @param bool $prefix
207 *
208 * @return array
209 */
210 public static function &export($prefix = FALSE) {
211 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_forward', $prefix, []);
212 return $r;
213 }
214
215 /**
216 * Returns the list of indices
217 *
218 * @param bool $localize
219 *
220 * @return array
221 */
222 public static function indices($localize = TRUE) {
223 $indices = [];
224 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
225 }
226
227 }