Merge pull request #18939 from colemanw/serializeFix
[civicrm-core.git] / CRM / PCP / DAO / PCPBlock.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/PCP/PCPBlock.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:4e188de537dbafef837dcc55947ee1b4)
10 */
11
12 /**
13 * Database access object for the PCPBlock entity.
14 */
15 class CRM_PCP_DAO_PCPBlock extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '2.2';
18 const COMPONENT = 'CiviContribute';
19
20 /**
21 * Static instance to hold the table name.
22 *
23 * @var string
24 */
25 public static $_tableName = 'civicrm_pcp_block';
26
27 /**
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 *
30 * @var bool
31 */
32 public static $_log = TRUE;
33
34 /**
35 * PCP block Id
36 *
37 * @var int
38 */
39 public $id;
40
41 /**
42 * @var string
43 */
44 public $entity_table;
45
46 /**
47 * FK to civicrm_contribution_page.id OR civicrm_event.id
48 *
49 * @var int
50 */
51 public $entity_id;
52
53 /**
54 * The type of entity that this pcp targets
55 *
56 * @var string
57 */
58 public $target_entity_type;
59
60 /**
61 * The entity that this pcp targets
62 *
63 * @var int
64 */
65 public $target_entity_id;
66
67 /**
68 * FK to civicrm_uf_group.id. Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?
69 *
70 * @var int
71 */
72 public $supporter_profile_id;
73
74 /**
75 * FK to civicrm_option_group with name = PCP owner notifications
76 *
77 * @var int
78 */
79 public $owner_notify_id;
80
81 /**
82 * Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?
83 *
84 * @var bool
85 */
86 public $is_approval_needed;
87
88 /**
89 * Does Personal Campaign Page allow using tell a friend?
90 *
91 * @var bool
92 */
93 public $is_tellfriend_enabled;
94
95 /**
96 * Maximum recipient fields allowed in tell a friend
97 *
98 * @var int
99 */
100 public $tellfriend_limit;
101
102 /**
103 * Link text for PCP.
104 *
105 * @var string
106 */
107 public $link_text;
108
109 /**
110 * Is Personal Campaign Page Block enabled/active?
111 *
112 * @var bool
113 */
114 public $is_active;
115
116 /**
117 * If set, notification is automatically emailed to this email-address on create/update Personal Campaign Page
118 *
119 * @var string
120 */
121 public $notify_email;
122
123 /**
124 * Class constructor.
125 */
126 public function __construct() {
127 $this->__table = 'civicrm_pcp_block';
128 parent::__construct();
129 }
130
131 /**
132 * Returns localized title of this entity.
133 *
134 * @param bool $plural
135 * Whether to return the plural version of the title.
136 */
137 public static function getEntityTitle($plural = FALSE) {
138 return $plural ? ts('PCPBlocks') : ts('PCPBlock');
139 }
140
141 /**
142 * Returns foreign keys and entity references.
143 *
144 * @return array
145 * [CRM_Core_Reference_Interface]
146 */
147 public static function getReferenceColumns() {
148 if (!isset(Civi::$statics[__CLASS__]['links'])) {
149 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
150 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'supporter_profile_id', 'civicrm_uf_group', 'id');
151 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
152 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'target_entity_id', NULL, 'id', 'target_entity_type');
153 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
154 }
155 return Civi::$statics[__CLASS__]['links'];
156 }
157
158 /**
159 * Returns all the column names of this table
160 *
161 * @return array
162 */
163 public static function &fields() {
164 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
165 Civi::$statics[__CLASS__]['fields'] = [
166 'id' => [
167 'name' => 'id',
168 'type' => CRM_Utils_Type::T_INT,
169 'title' => ts('PCP Block ID'),
170 'description' => ts('PCP block Id'),
171 'required' => TRUE,
172 'where' => 'civicrm_pcp_block.id',
173 'table_name' => 'civicrm_pcp_block',
174 'entity' => 'PCPBlock',
175 'bao' => 'CRM_PCP_BAO_PCPBlock',
176 'localizable' => 0,
177 'add' => '2.2',
178 ],
179 'entity_table' => [
180 'name' => 'entity_table',
181 'type' => CRM_Utils_Type::T_STRING,
182 'title' => ts('Entity Table'),
183 'maxlength' => 64,
184 'size' => CRM_Utils_Type::BIG,
185 'where' => 'civicrm_pcp_block.entity_table',
186 'table_name' => 'civicrm_pcp_block',
187 'entity' => 'PCPBlock',
188 'bao' => 'CRM_PCP_BAO_PCPBlock',
189 'localizable' => 0,
190 'add' => '2.2',
191 ],
192 'entity_id' => [
193 'name' => 'entity_id',
194 'type' => CRM_Utils_Type::T_INT,
195 'title' => ts('Entity'),
196 'description' => ts('FK to civicrm_contribution_page.id OR civicrm_event.id'),
197 'required' => TRUE,
198 'where' => 'civicrm_pcp_block.entity_id',
199 'table_name' => 'civicrm_pcp_block',
200 'entity' => 'PCPBlock',
201 'bao' => 'CRM_PCP_BAO_PCPBlock',
202 'localizable' => 0,
203 'add' => '2.2',
204 ],
205 'target_entity_type' => [
206 'name' => 'target_entity_type',
207 'type' => CRM_Utils_Type::T_STRING,
208 'title' => ts('Target Entity'),
209 'description' => ts('The type of entity that this pcp targets'),
210 'required' => TRUE,
211 'maxlength' => 255,
212 'size' => CRM_Utils_Type::HUGE,
213 'where' => 'civicrm_pcp_block.target_entity_type',
214 'default' => 'contribute',
215 'table_name' => 'civicrm_pcp_block',
216 'entity' => 'PCPBlock',
217 'bao' => 'CRM_PCP_BAO_PCPBlock',
218 'localizable' => 0,
219 'add' => '4.1',
220 ],
221 'target_entity_id' => [
222 'name' => 'target_entity_id',
223 'type' => CRM_Utils_Type::T_INT,
224 'title' => ts('Target Entity ID'),
225 'description' => ts('The entity that this pcp targets'),
226 'required' => TRUE,
227 'where' => 'civicrm_pcp_block.target_entity_id',
228 'table_name' => 'civicrm_pcp_block',
229 'entity' => 'PCPBlock',
230 'bao' => 'CRM_PCP_BAO_PCPBlock',
231 'localizable' => 0,
232 'add' => '4.1',
233 ],
234 'supporter_profile_id' => [
235 'name' => 'supporter_profile_id',
236 'type' => CRM_Utils_Type::T_INT,
237 'title' => ts('Supporter Profile'),
238 'description' => ts('FK to civicrm_uf_group.id. Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'),
239 'where' => 'civicrm_pcp_block.supporter_profile_id',
240 'default' => 'NULL',
241 'table_name' => 'civicrm_pcp_block',
242 'entity' => 'PCPBlock',
243 'bao' => 'CRM_PCP_BAO_PCPBlock',
244 'localizable' => 0,
245 'FKClassName' => 'CRM_Core_DAO_UFGroup',
246 'add' => '2.2',
247 ],
248 'owner_notify_id' => [
249 'name' => 'owner_notify_id',
250 'type' => CRM_Utils_Type::T_INT,
251 'title' => ts('Owner Notification'),
252 'description' => ts('FK to civicrm_option_group with name = PCP owner notifications'),
253 'where' => 'civicrm_pcp_block.owner_notify_id',
254 'default' => '0',
255 'table_name' => 'civicrm_pcp_block',
256 'entity' => 'PCPBlock',
257 'bao' => 'CRM_PCP_BAO_PCPBlock',
258 'localizable' => 0,
259 'html' => [
260 'type' => 'Radio',
261 ],
262 'pseudoconstant' => [
263 'optionGroupName' => 'pcp_owner_notify',
264 'optionEditPath' => 'civicrm/admin/options/pcp_owner_notify',
265 ],
266 'add' => '4.6',
267 ],
268 'is_approval_needed' => [
269 'name' => 'is_approval_needed',
270 'type' => CRM_Utils_Type::T_BOOLEAN,
271 'title' => ts('Approval Required?'),
272 'description' => ts('Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'),
273 'where' => 'civicrm_pcp_block.is_approval_needed',
274 'default' => 'NULL',
275 'table_name' => 'civicrm_pcp_block',
276 'entity' => 'PCPBlock',
277 'bao' => 'CRM_PCP_BAO_PCPBlock',
278 'localizable' => 0,
279 'add' => '2.2',
280 ],
281 'is_tellfriend_enabled' => [
282 'name' => 'is_tellfriend_enabled',
283 'type' => CRM_Utils_Type::T_BOOLEAN,
284 'title' => ts('Tell a Friend Enabled?'),
285 'description' => ts('Does Personal Campaign Page allow using tell a friend?'),
286 'where' => 'civicrm_pcp_block.is_tellfriend_enabled',
287 'default' => 'NULL',
288 'table_name' => 'civicrm_pcp_block',
289 'entity' => 'PCPBlock',
290 'bao' => 'CRM_PCP_BAO_PCPBlock',
291 'localizable' => 0,
292 'add' => '2.2',
293 ],
294 'tellfriend_limit' => [
295 'name' => 'tellfriend_limit',
296 'type' => CRM_Utils_Type::T_INT,
297 'title' => ts('Tell A Friend Limit'),
298 'description' => ts('Maximum recipient fields allowed in tell a friend'),
299 'where' => 'civicrm_pcp_block.tellfriend_limit',
300 'default' => 'NULL',
301 'table_name' => 'civicrm_pcp_block',
302 'entity' => 'PCPBlock',
303 'bao' => 'CRM_PCP_BAO_PCPBlock',
304 'localizable' => 0,
305 'add' => '2.2',
306 ],
307 'link_text' => [
308 'name' => 'link_text',
309 'type' => CRM_Utils_Type::T_STRING,
310 'title' => ts('Link Text'),
311 'description' => ts('Link text for PCP.'),
312 'maxlength' => 255,
313 'size' => CRM_Utils_Type::HUGE,
314 'where' => 'civicrm_pcp_block.link_text',
315 'default' => 'NULL',
316 'table_name' => 'civicrm_pcp_block',
317 'entity' => 'PCPBlock',
318 'bao' => 'CRM_PCP_BAO_PCPBlock',
319 'localizable' => 1,
320 'add' => '2.2',
321 ],
322 'is_active' => [
323 'name' => 'is_active',
324 'type' => CRM_Utils_Type::T_BOOLEAN,
325 'title' => ts('Enabled?'),
326 'description' => ts('Is Personal Campaign Page Block enabled/active?'),
327 'where' => 'civicrm_pcp_block.is_active',
328 'default' => '1',
329 'table_name' => 'civicrm_pcp_block',
330 'entity' => 'PCPBlock',
331 'bao' => 'CRM_PCP_BAO_PCPBlock',
332 'localizable' => 0,
333 'add' => '2.2',
334 ],
335 'notify_email' => [
336 'name' => 'notify_email',
337 'type' => CRM_Utils_Type::T_STRING,
338 'title' => ts('Notification Email'),
339 'description' => ts('If set, notification is automatically emailed to this email-address on create/update Personal Campaign Page'),
340 'maxlength' => 255,
341 'size' => CRM_Utils_Type::HUGE,
342 'where' => 'civicrm_pcp_block.notify_email',
343 'default' => 'NULL',
344 'table_name' => 'civicrm_pcp_block',
345 'entity' => 'PCPBlock',
346 'bao' => 'CRM_PCP_BAO_PCPBlock',
347 'localizable' => 0,
348 'add' => '2.2',
349 ],
350 ];
351 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
352 }
353 return Civi::$statics[__CLASS__]['fields'];
354 }
355
356 /**
357 * Return a mapping from field-name to the corresponding key (as used in fields()).
358 *
359 * @return array
360 * Array(string $name => string $uniqueName).
361 */
362 public static function &fieldKeys() {
363 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
364 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
365 }
366 return Civi::$statics[__CLASS__]['fieldKeys'];
367 }
368
369 /**
370 * Returns the names of this table
371 *
372 * @return string
373 */
374 public static function getTableName() {
375 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
376 }
377
378 /**
379 * Returns if this table needs to be logged
380 *
381 * @return bool
382 */
383 public function getLog() {
384 return self::$_log;
385 }
386
387 /**
388 * Returns the list of fields that can be imported
389 *
390 * @param bool $prefix
391 *
392 * @return array
393 */
394 public static function &import($prefix = FALSE) {
395 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'pcp_block', $prefix, []);
396 return $r;
397 }
398
399 /**
400 * Returns the list of fields that can be exported
401 *
402 * @param bool $prefix
403 *
404 * @return array
405 */
406 public static function &export($prefix = FALSE) {
407 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'pcp_block', $prefix, []);
408 return $r;
409 }
410
411 /**
412 * Returns the list of indices
413 *
414 * @param bool $localize
415 *
416 * @return array
417 */
418 public static function indices($localize = TRUE) {
419 $indices = [];
420 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
421 }
422
423 }