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