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