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