Merge pull request #23213 from eileenmcnaughton/post
[civicrm-core.git] / CRM / Core / DAO / RecurringEntity.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/RecurringEntity.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:d8ff65b4009b67e8619f6f904c1b501d)
10 */
11
12 /**
13 * Database access object for the RecurringEntity entity.
14 */
15 class CRM_Core_DAO_RecurringEntity extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '4.6';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_recurring_entity';
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 = TRUE;
32
33 /**
34 * @var int|string|null
35 * (SQL type: int unsigned)
36 * Note that values will be retrieved from the database as a string.
37 */
38 public $id;
39
40 /**
41 * Recurring Entity Parent ID
42 *
43 * @var int|string
44 * (SQL type: int unsigned)
45 * Note that values will be retrieved from the database as a string.
46 */
47 public $parent_id;
48
49 /**
50 * Recurring Entity Child ID
51 *
52 * @var int|string|null
53 * (SQL type: int unsigned)
54 * Note that values will be retrieved from the database as a string.
55 */
56 public $entity_id;
57
58 /**
59 * Physical tablename for entity, e.g. civicrm_event
60 *
61 * @var string
62 * (SQL type: varchar(64))
63 * Note that values will be retrieved from the database as a string.
64 */
65 public $entity_table;
66
67 /**
68 * 1-this entity, 2-this and the following entities, 3-all the entities
69 *
70 * @var bool|string
71 * (SQL type: tinyint)
72 * Note that values will be retrieved from the database as a string.
73 */
74 public $mode;
75
76 /**
77 * Class constructor.
78 */
79 public function __construct() {
80 $this->__table = 'civicrm_recurring_entity';
81 parent::__construct();
82 }
83
84 /**
85 * Returns localized title of this entity.
86 *
87 * @param bool $plural
88 * Whether to return the plural version of the title.
89 */
90 public static function getEntityTitle($plural = FALSE) {
91 return $plural ? ts('Recurring Entities') : ts('Recurring Entity');
92 }
93
94 /**
95 * Returns all the column names of this table
96 *
97 * @return array
98 */
99 public static function &fields() {
100 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
101 Civi::$statics[__CLASS__]['fields'] = [
102 'id' => [
103 'name' => 'id',
104 'type' => CRM_Utils_Type::T_INT,
105 'title' => ts('ID'),
106 'required' => TRUE,
107 'where' => 'civicrm_recurring_entity.id',
108 'table_name' => 'civicrm_recurring_entity',
109 'entity' => 'RecurringEntity',
110 'bao' => 'CRM_Core_BAO_RecurringEntity',
111 'localizable' => 0,
112 'html' => [
113 'type' => 'Number',
114 ],
115 'readonly' => TRUE,
116 'add' => '4.6',
117 ],
118 'parent_id' => [
119 'name' => 'parent_id',
120 'type' => CRM_Utils_Type::T_INT,
121 'title' => ts('Parent ID'),
122 'description' => ts('Recurring Entity Parent ID'),
123 'required' => TRUE,
124 'where' => 'civicrm_recurring_entity.parent_id',
125 'table_name' => 'civicrm_recurring_entity',
126 'entity' => 'RecurringEntity',
127 'bao' => 'CRM_Core_BAO_RecurringEntity',
128 'localizable' => 0,
129 'add' => '4.6',
130 ],
131 'entity_id' => [
132 'name' => 'entity_id',
133 'type' => CRM_Utils_Type::T_INT,
134 'title' => ts('Entity ID'),
135 'description' => ts('Recurring Entity Child ID'),
136 'where' => 'civicrm_recurring_entity.entity_id',
137 'table_name' => 'civicrm_recurring_entity',
138 'entity' => 'RecurringEntity',
139 'bao' => 'CRM_Core_BAO_RecurringEntity',
140 'localizable' => 0,
141 'add' => '4.6',
142 ],
143 'entity_table' => [
144 'name' => 'entity_table',
145 'type' => CRM_Utils_Type::T_STRING,
146 'title' => ts('Entity Table'),
147 'description' => ts('Physical tablename for entity, e.g. civicrm_event'),
148 'required' => TRUE,
149 'maxlength' => 64,
150 'size' => CRM_Utils_Type::BIG,
151 'where' => 'civicrm_recurring_entity.entity_table',
152 'table_name' => 'civicrm_recurring_entity',
153 'entity' => 'RecurringEntity',
154 'bao' => 'CRM_Core_BAO_RecurringEntity',
155 'localizable' => 0,
156 'add' => '4.6',
157 ],
158 'mode' => [
159 'name' => 'mode',
160 'type' => CRM_Utils_Type::T_BOOLEAN,
161 'title' => ts('Cascade Type'),
162 'description' => ts('1-this entity, 2-this and the following entities, 3-all the entities'),
163 'required' => TRUE,
164 'where' => 'civicrm_recurring_entity.mode',
165 'default' => '1',
166 'table_name' => 'civicrm_recurring_entity',
167 'entity' => 'RecurringEntity',
168 'bao' => 'CRM_Core_BAO_RecurringEntity',
169 'localizable' => 0,
170 'add' => '4.6',
171 ],
172 ];
173 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
174 }
175 return Civi::$statics[__CLASS__]['fields'];
176 }
177
178 /**
179 * Return a mapping from field-name to the corresponding key (as used in fields()).
180 *
181 * @return array
182 * Array(string $name => string $uniqueName).
183 */
184 public static function &fieldKeys() {
185 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
186 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
187 }
188 return Civi::$statics[__CLASS__]['fieldKeys'];
189 }
190
191 /**
192 * Returns the names of this table
193 *
194 * @return string
195 */
196 public static function getTableName() {
197 return self::$_tableName;
198 }
199
200 /**
201 * Returns if this table needs to be logged
202 *
203 * @return bool
204 */
205 public function getLog() {
206 return self::$_log;
207 }
208
209 /**
210 * Returns the list of fields that can be imported
211 *
212 * @param bool $prefix
213 *
214 * @return array
215 */
216 public static function &import($prefix = FALSE) {
217 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'recurring_entity', $prefix, []);
218 return $r;
219 }
220
221 /**
222 * Returns the list of fields that can be exported
223 *
224 * @param bool $prefix
225 *
226 * @return array
227 */
228 public static function &export($prefix = FALSE) {
229 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'recurring_entity', $prefix, []);
230 return $r;
231 }
232
233 /**
234 * Returns the list of indices
235 *
236 * @param bool $localize
237 *
238 * @return array
239 */
240 public static function indices($localize = TRUE) {
241 $indices = [];
242 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
243 }
244
245 }