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