Merge pull request #14276 from eileenmcnaughton/dbunit_2
[civicrm-core.git] / CRM / Core / DAO / Persistent.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
6b83d5bd 5 * @copyright CiviCRM LLC (c) 2004-2019
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/Persistent.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
042043f1 9 * (GenCodeChecksum:14c5925588d0118aaca8c29b7039c917)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the Persistent entity.
f41f0342 14 */
e501603b 15class CRM_Core_DAO_Persistent extends CRM_Core_DAO {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
fa45b5b9 22 public static $_tableName = 'civicrm_persistent';
c3fc2621 23
e501603b 24 /**
f41f0342 25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 26 *
c3fc2621 27 * @var bool
e501603b 28 */
fa45b5b9 29 public static $_log = FALSE;
c3fc2621 30
e501603b
TO
31 /**
32 * Persistent Record Id
33 *
34 * @var int unsigned
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * Context for which name data pair is to be stored
40 *
41 * @var string
42 */
43 public $context;
c3fc2621 44
e501603b
TO
45 /**
46 * Name of Context
47 *
48 * @var string
49 */
50 public $name;
c3fc2621 51
e501603b
TO
52 /**
53 * data associated with name
54 *
55 * @var longtext
56 */
57 public $data;
c3fc2621 58
e501603b
TO
59 /**
60 * Config Settings
61 *
62 * @var boolean
63 */
64 public $is_config;
c3fc2621 65
e501603b 66 /**
f41f0342 67 * Class constructor.
e501603b 68 */
c3fc2621 69 public function __construct() {
e501603b
TO
70 $this->__table = 'civicrm_persistent';
71 parent::__construct();
72 }
c3fc2621 73
e501603b
TO
74 /**
75 * Returns all the column names of this table
76 *
77 * @return array
78 */
c3fc2621 79 public static function &fields() {
346aaaba 80 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
81 Civi::$statics[__CLASS__]['fields'] = [
82 'id' => [
e501603b
TO
83 'name' => 'id',
84 'type' => CRM_Utils_Type::T_INT,
c3fc2621 85 'title' => ts('Persistent ID'),
215b423e 86 'description' => ts('Persistent Record Id'),
c3fc2621 87 'required' => TRUE,
a36434b9 88 'where' => 'civicrm_persistent.id',
522a26c9 89 'table_name' => 'civicrm_persistent',
90 'entity' => 'Persistent',
91 'bao' => 'CRM_Core_BAO_Persistent',
6a7e5e5d 92 'localizable' => 0,
c3fc2621
CW
93 ],
94 'context' => [
e501603b
TO
95 'name' => 'context',
96 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 97 'title' => ts('Context'),
215b423e 98 'description' => ts('Context for which name data pair is to be stored'),
c3fc2621 99 'required' => TRUE,
e501603b
TO
100 'maxlength' => 255,
101 'size' => CRM_Utils_Type::HUGE,
a36434b9 102 'where' => 'civicrm_persistent.context',
522a26c9 103 'table_name' => 'civicrm_persistent',
104 'entity' => 'Persistent',
105 'bao' => 'CRM_Core_BAO_Persistent',
6a7e5e5d 106 'localizable' => 0,
c3fc2621
CW
107 ],
108 'name' => [
e501603b
TO
109 'name' => 'name',
110 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 111 'title' => ts('Name'),
215b423e 112 'description' => ts('Name of Context'),
c3fc2621 113 'required' => TRUE,
e501603b
TO
114 'maxlength' => 255,
115 'size' => CRM_Utils_Type::HUGE,
a36434b9 116 'where' => 'civicrm_persistent.name',
522a26c9 117 'table_name' => 'civicrm_persistent',
118 'entity' => 'Persistent',
119 'bao' => 'CRM_Core_BAO_Persistent',
6a7e5e5d 120 'localizable' => 0,
c3fc2621
CW
121 ],
122 'data' => [
e501603b
TO
123 'name' => 'data',
124 'type' => CRM_Utils_Type::T_LONGTEXT,
c3fc2621 125 'title' => ts('Data'),
215b423e 126 'description' => ts('data associated with name'),
a36434b9 127 'where' => 'civicrm_persistent.data',
522a26c9 128 'table_name' => 'civicrm_persistent',
129 'entity' => 'Persistent',
130 'bao' => 'CRM_Core_BAO_Persistent',
6a7e5e5d 131 'localizable' => 0,
c3fc2621
CW
132 ],
133 'is_config' => [
e501603b
TO
134 'name' => 'is_config',
135 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 136 'title' => ts('Is Configuration?'),
215b423e 137 'description' => ts('Config Settings'),
c3fc2621 138 'required' => TRUE,
a36434b9 139 'where' => 'civicrm_persistent.is_config',
45a83e42 140 'default' => '0',
522a26c9 141 'table_name' => 'civicrm_persistent',
142 'entity' => 'Persistent',
143 'bao' => 'CRM_Core_BAO_Persistent',
6a7e5e5d 144 'localizable' => 0,
c3fc2621
CW
145 ],
146 ];
346aaaba 147 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 148 }
346aaaba 149 return Civi::$statics[__CLASS__]['fields'];
e501603b 150 }
c3fc2621 151
e501603b 152 /**
bd8e0b14 153 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
154 *
155 * @return array
bd8e0b14 156 * Array(string $name => string $uniqueName).
e501603b 157 */
c3fc2621 158 public static function &fieldKeys() {
bd8e0b14
TO
159 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
160 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 161 }
bd8e0b14 162 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 163 }
c3fc2621 164
e501603b
TO
165 /**
166 * Returns the names of this table
167 *
168 * @return string
169 */
c3fc2621 170 public static function getTableName() {
e501603b
TO
171 return self::$_tableName;
172 }
c3fc2621 173
e501603b
TO
174 /**
175 * Returns if this table needs to be logged
176 *
c3fc2621 177 * @return bool
e501603b 178 */
c3fc2621 179 public function getLog() {
e501603b
TO
180 return self::$_log;
181 }
c3fc2621 182
e501603b
TO
183 /**
184 * Returns the list of fields that can be imported
185 *
186 * @param bool $prefix
187 *
188 * @return array
189 */
c3fc2621
CW
190 public static function &import($prefix = FALSE) {
191 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'persistent', $prefix, []);
60808919 192 return $r;
e501603b 193 }
c3fc2621 194
e501603b
TO
195 /**
196 * Returns the list of fields that can be exported
197 *
198 * @param bool $prefix
199 *
200 * @return array
201 */
c3fc2621
CW
202 public static function &export($prefix = FALSE) {
203 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'persistent', $prefix, []);
60808919 204 return $r;
e501603b 205 }
c3fc2621 206
e7a6b91a
AS
207 /**
208 * Returns the list of indices
c3fc2621
CW
209 *
210 * @param bool $localize
211 *
212 * @return array
e7a6b91a
AS
213 */
214 public static function indices($localize = TRUE) {
c3fc2621 215 $indices = [];
e7a6b91a
AS
216 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
217 }
c3fc2621 218
e501603b 219}