Merge pull request #14080 from MegaphoneJon/drupal-56
[civicrm-core.git] / CRM / Core / DAO / Persistent.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Core/Persistent.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:0c52f813dd1e954e1709b819128790f3)
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 public 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 public 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' => ts('Persistent Record Id'),
87 'required' => TRUE,
88 'where' => 'civicrm_persistent.id',
89 'table_name' => 'civicrm_persistent',
90 'entity' => 'Persistent',
91 'bao' => 'CRM_Core_BAO_Persistent',
92 'localizable' => 0,
93 ],
94 'context' => [
95 'name' => 'context',
96 'type' => CRM_Utils_Type::T_STRING,
97 'title' => ts('Context'),
98 'description' => ts('Context for which name data pair is to be stored'),
99 'required' => TRUE,
100 'maxlength' => 255,
101 'size' => CRM_Utils_Type::HUGE,
102 'where' => 'civicrm_persistent.context',
103 'table_name' => 'civicrm_persistent',
104 'entity' => 'Persistent',
105 'bao' => 'CRM_Core_BAO_Persistent',
106 'localizable' => 0,
107 ],
108 'name' => [
109 'name' => 'name',
110 'type' => CRM_Utils_Type::T_STRING,
111 'title' => ts('Name'),
112 'description' => ts('Name of Context'),
113 'required' => TRUE,
114 'maxlength' => 255,
115 'size' => CRM_Utils_Type::HUGE,
116 'where' => 'civicrm_persistent.name',
117 'table_name' => 'civicrm_persistent',
118 'entity' => 'Persistent',
119 'bao' => 'CRM_Core_BAO_Persistent',
120 'localizable' => 0,
121 ],
122 'data' => [
123 'name' => 'data',
124 'type' => CRM_Utils_Type::T_LONGTEXT,
125 'title' => ts('Data'),
126 'description' => ts('data associated with name'),
127 'where' => 'civicrm_persistent.data',
128 'table_name' => 'civicrm_persistent',
129 'entity' => 'Persistent',
130 'bao' => 'CRM_Core_BAO_Persistent',
131 'localizable' => 0,
132 ],
133 'is_config' => [
134 'name' => 'is_config',
135 'type' => CRM_Utils_Type::T_BOOLEAN,
136 'title' => ts('Is Configuration?'),
137 'description' => ts('Config Settings'),
138 'required' => TRUE,
139 'where' => 'civicrm_persistent.is_config',
140 'default' => '0',
141 'table_name' => 'civicrm_persistent',
142 'entity' => 'Persistent',
143 'bao' => 'CRM_Core_BAO_Persistent',
144 'localizable' => 0,
145 ],
146 ];
147 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
148 }
149 return Civi::$statics[__CLASS__]['fields'];
150 }
151
152 /**
153 * Return a mapping from field-name to the corresponding key (as used in fields()).
154 *
155 * @return array
156 * Array(string $name => string $uniqueName).
157 */
158 public static function &fieldKeys() {
159 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
160 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
161 }
162 return Civi::$statics[__CLASS__]['fieldKeys'];
163 }
164
165 /**
166 * Returns the names of this table
167 *
168 * @return string
169 */
170 public static function getTableName() {
171 return self::$_tableName;
172 }
173
174 /**
175 * Returns if this table needs to be logged
176 *
177 * @return bool
178 */
179 public function getLog() {
180 return self::$_log;
181 }
182
183 /**
184 * Returns the list of fields that can be imported
185 *
186 * @param bool $prefix
187 *
188 * @return array
189 */
190 public static function &import($prefix = FALSE) {
191 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'persistent', $prefix, []);
192 return $r;
193 }
194
195 /**
196 * Returns the list of fields that can be exported
197 *
198 * @param bool $prefix
199 *
200 * @return array
201 */
202 public static function &export($prefix = FALSE) {
203 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'persistent', $prefix, []);
204 return $r;
205 }
206
207 /**
208 * Returns the list of indices
209 *
210 * @param bool $localize
211 *
212 * @return array
213 */
214 public static function indices($localize = TRUE) {
215 $indices = [];
216 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
217 }
218
219 }