DAOs with singular/plural options for entity titles
[civicrm-core.git] / CRM / Mailing / Event / DAO / Queue.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Mailing/Event/Queue.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
7b66c3b5 9 * (GenCodeChecksum:f37d1a6e35b4f827ed7daf29b3005fad)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the Queue entity.
f41f0342 14 */
e501603b 15class CRM_Mailing_Event_DAO_Queue extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '';
c3fc2621 18
e501603b 19 /**
f41f0342 20 * Static instance to hold the table name.
e501603b
TO
21 *
22 * @var string
23 */
fa45b5b9 24 public static $_tableName = 'civicrm_mailing_event_queue';
c3fc2621 25
e501603b 26 /**
f41f0342 27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 28 *
c3fc2621 29 * @var bool
e501603b 30 */
fa45b5b9 31 public static $_log = FALSE;
c3fc2621 32
e501603b 33 /**
e6ca0a57 34 * @var int
e501603b
TO
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * FK to Job
40 *
e6ca0a57 41 * @var int
e501603b
TO
42 */
43 public $job_id;
c3fc2621 44
e501603b
TO
45 /**
46 * FK to Email
47 *
e6ca0a57 48 * @var int
e501603b
TO
49 */
50 public $email_id;
c3fc2621 51
e501603b
TO
52 /**
53 * FK to Contact
54 *
e6ca0a57 55 * @var int
e501603b
TO
56 */
57 public $contact_id;
c3fc2621 58
e501603b
TO
59 /**
60 * Security hash
61 *
62 * @var string
63 */
64 public $hash;
c3fc2621 65
e501603b
TO
66 /**
67 * FK to Phone
68 *
e6ca0a57 69 * @var int
e501603b
TO
70 */
71 public $phone_id;
c3fc2621 72
e501603b 73 /**
f41f0342 74 * Class constructor.
e501603b 75 */
c3fc2621 76 public function __construct() {
e501603b
TO
77 $this->__table = 'civicrm_mailing_event_queue';
78 parent::__construct();
79 }
c3fc2621 80
449c4e6b
CW
81 /**
82 * Returns localized title of this entity.
7b66c3b5
AH
83 *
84 * @param bool $plural
85 * Whether to return the plural version of the title.
449c4e6b 86 */
7b66c3b5
AH
87 public static function getEntityTitle($plural = FALSE) {
88 return $plural ? ts('Queues') : ts('Queue');
449c4e6b
CW
89 }
90
e501603b 91 /**
f41f0342 92 * Returns foreign keys and entity references.
e501603b
TO
93 *
94 * @return array
95 * [CRM_Core_Reference_Interface]
96 */
c3fc2621 97 public static function getReferenceColumns() {
346aaaba 98 if (!isset(Civi::$statics[__CLASS__]['links'])) {
a36434b9 99 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
100 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'job_id', 'civicrm_mailing_job', 'id');
101 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'email_id', 'civicrm_email', 'id');
102 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
103 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'phone_id', 'civicrm_phone', 'id');
346aaaba 104 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 105 }
346aaaba 106 return Civi::$statics[__CLASS__]['links'];
e501603b 107 }
c3fc2621 108
e501603b
TO
109 /**
110 * Returns all the column names of this table
111 *
112 * @return array
113 */
c3fc2621 114 public static function &fields() {
346aaaba 115 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
116 Civi::$statics[__CLASS__]['fields'] = [
117 'id' => [
e501603b
TO
118 'name' => 'id',
119 'type' => CRM_Utils_Type::T_INT,
c3fc2621
CW
120 'title' => ts('Mailing Event Queue ID'),
121 'required' => TRUE,
a36434b9 122 'where' => 'civicrm_mailing_event_queue.id',
522a26c9 123 'table_name' => 'civicrm_mailing_event_queue',
124 'entity' => 'Queue',
125 'bao' => 'CRM_Mailing_Event_BAO_Queue',
6a7e5e5d 126 'localizable' => 0,
a9d0587b 127 'add' => NULL,
c3fc2621
CW
128 ],
129 'job_id' => [
e501603b
TO
130 'name' => 'job_id',
131 'type' => CRM_Utils_Type::T_INT,
c3fc2621 132 'title' => ts('Job ID'),
215b423e 133 'description' => ts('FK to Job'),
c3fc2621 134 'required' => TRUE,
a36434b9 135 'where' => 'civicrm_mailing_event_queue.job_id',
522a26c9 136 'table_name' => 'civicrm_mailing_event_queue',
137 'entity' => 'Queue',
138 'bao' => 'CRM_Mailing_Event_BAO_Queue',
6a7e5e5d 139 'localizable' => 0,
e501603b 140 'FKClassName' => 'CRM_Mailing_DAO_MailingJob',
a9d0587b 141 'add' => NULL,
c3fc2621
CW
142 ],
143 'email_id' => [
e501603b
TO
144 'name' => 'email_id',
145 'type' => CRM_Utils_Type::T_INT,
c3fc2621 146 'title' => ts('Email ID'),
215b423e 147 'description' => ts('FK to Email'),
a36434b9 148 'where' => 'civicrm_mailing_event_queue.email_id',
e501603b 149 'default' => 'NULL',
522a26c9 150 'table_name' => 'civicrm_mailing_event_queue',
151 'entity' => 'Queue',
152 'bao' => 'CRM_Mailing_Event_BAO_Queue',
6a7e5e5d 153 'localizable' => 0,
e501603b 154 'FKClassName' => 'CRM_Core_DAO_Email',
a9d0587b 155 'add' => NULL,
c3fc2621
CW
156 ],
157 'contact_id' => [
e501603b
TO
158 'name' => 'contact_id',
159 'type' => CRM_Utils_Type::T_INT,
c3fc2621 160 'title' => ts('Contact ID'),
215b423e 161 'description' => ts('FK to Contact'),
c3fc2621 162 'required' => TRUE,
a36434b9 163 'where' => 'civicrm_mailing_event_queue.contact_id',
522a26c9 164 'table_name' => 'civicrm_mailing_event_queue',
165 'entity' => 'Queue',
166 'bao' => 'CRM_Mailing_Event_BAO_Queue',
6a7e5e5d 167 'localizable' => 0,
e501603b 168 'FKClassName' => 'CRM_Contact_DAO_Contact',
a9d0587b 169 'add' => NULL,
c3fc2621
CW
170 ],
171 'hash' => [
e501603b
TO
172 'name' => 'hash',
173 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 174 'title' => ts('Security Hash'),
215b423e 175 'description' => ts('Security hash'),
c3fc2621 176 'required' => TRUE,
e501603b
TO
177 'maxlength' => 255,
178 'size' => CRM_Utils_Type::HUGE,
a36434b9 179 'where' => 'civicrm_mailing_event_queue.hash',
522a26c9 180 'table_name' => 'civicrm_mailing_event_queue',
181 'entity' => 'Queue',
182 'bao' => 'CRM_Mailing_Event_BAO_Queue',
6a7e5e5d 183 'localizable' => 0,
a9d0587b 184 'add' => NULL,
c3fc2621
CW
185 ],
186 'phone_id' => [
e501603b
TO
187 'name' => 'phone_id',
188 'type' => CRM_Utils_Type::T_INT,
c3fc2621 189 'title' => ts('Phone ID'),
215b423e 190 'description' => ts('FK to Phone'),
a36434b9 191 'where' => 'civicrm_mailing_event_queue.phone_id',
e501603b 192 'default' => 'NULL',
522a26c9 193 'table_name' => 'civicrm_mailing_event_queue',
194 'entity' => 'Queue',
195 'bao' => 'CRM_Mailing_Event_BAO_Queue',
6a7e5e5d 196 'localizable' => 0,
e501603b 197 'FKClassName' => 'CRM_Core_DAO_Phone',
a9d0587b 198 'add' => NULL,
c3fc2621
CW
199 ],
200 ];
346aaaba 201 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 202 }
346aaaba 203 return Civi::$statics[__CLASS__]['fields'];
e501603b 204 }
c3fc2621 205
e501603b 206 /**
bd8e0b14 207 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
208 *
209 * @return array
bd8e0b14 210 * Array(string $name => string $uniqueName).
e501603b 211 */
c3fc2621 212 public static function &fieldKeys() {
bd8e0b14
TO
213 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
214 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 215 }
bd8e0b14 216 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 217 }
c3fc2621 218
e501603b
TO
219 /**
220 * Returns the names of this table
221 *
222 * @return string
223 */
c3fc2621 224 public static function getTableName() {
e501603b
TO
225 return self::$_tableName;
226 }
c3fc2621 227
e501603b
TO
228 /**
229 * Returns if this table needs to be logged
230 *
c3fc2621 231 * @return bool
e501603b 232 */
c3fc2621 233 public function getLog() {
e501603b
TO
234 return self::$_log;
235 }
c3fc2621 236
e501603b
TO
237 /**
238 * Returns the list of fields that can be imported
239 *
240 * @param bool $prefix
241 *
242 * @return array
243 */
c3fc2621
CW
244 public static function &import($prefix = FALSE) {
245 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'mailing_event_queue', $prefix, []);
60808919 246 return $r;
e501603b 247 }
c3fc2621 248
e501603b
TO
249 /**
250 * Returns the list of fields that can be exported
251 *
252 * @param bool $prefix
253 *
254 * @return array
255 */
c3fc2621
CW
256 public static function &export($prefix = FALSE) {
257 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'mailing_event_queue', $prefix, []);
60808919 258 return $r;
e501603b 259 }
c3fc2621 260
e7a6b91a
AS
261 /**
262 * Returns the list of indices
c3fc2621
CW
263 *
264 * @param bool $localize
265 *
266 * @return array
e7a6b91a
AS
267 */
268 public static function indices($localize = TRUE) {
c3fc2621
CW
269 $indices = [
270 'index_hash' => [
ab49600a 271 'name' => 'index_hash',
c3fc2621 272 'field' => [
ab49600a 273 0 => 'hash',
c3fc2621
CW
274 ],
275 'localizable' => FALSE,
ab49600a 276 'sig' => 'civicrm_mailing_event_queue::0::hash',
c3fc2621
CW
277 ],
278 ];
e7a6b91a
AS
279 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
280 }
c3fc2621 281
e501603b 282}