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