fixup CRM-14885 - Import DAOs
[civicrm-core.git] / CRM / Core / DAO / Persistent.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27 /**
28 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2016
30 *
31 * Generated from xml/schema/CRM/Core/Persistent.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:9b08831f82375bb41e0f54c03b69b79e)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Core_DAO_Persistent extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_persistent';
44 /**
45 * static instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
50 /**
51 * static instance to hold the keys used in $_fields for each field.
52 *
53 * @var array
54 */
55 static $_fieldKeys = null;
56 /**
57 * static instance to hold the FK relationships
58 *
59 * @var string
60 */
61 static $_links = null;
62 /**
63 * static instance to hold the values that can
64 * be imported
65 *
66 * @var array
67 */
68 static $_import = null;
69 /**
70 * static instance to hold the values that can
71 * be exported
72 *
73 * @var array
74 */
75 static $_export = null;
76 /**
77 * static value to see if we should log any modifications to
78 * this table in the civicrm_log table
79 *
80 * @var boolean
81 */
82 static $_log = false;
83 /**
84 * Persistent Record Id
85 *
86 * @var int unsigned
87 */
88 public $id;
89 /**
90 * Context for which name data pair is to be stored
91 *
92 * @var string
93 */
94 public $context;
95 /**
96 * Name of Context
97 *
98 * @var string
99 */
100 public $name;
101 /**
102 * data associated with name
103 *
104 * @var longtext
105 */
106 public $data;
107 /**
108 * Config Settings
109 *
110 * @var boolean
111 */
112 public $is_config;
113 /**
114 * class constructor
115 *
116 * @return civicrm_persistent
117 */
118 function __construct() {
119 $this->__table = 'civicrm_persistent';
120 parent::__construct();
121 }
122 /**
123 * Returns all the column names of this table
124 *
125 * @return array
126 */
127 static function &fields() {
128 if (!(self::$_fields)) {
129 self::$_fields = array(
130 'id' => array(
131 'name' => 'id',
132 'type' => CRM_Utils_Type::T_INT,
133 'title' => ts('Persistent ID') ,
134 'description' => 'Persistent Record Id',
135 'required' => true,
136 ) ,
137 'context' => array(
138 'name' => 'context',
139 'type' => CRM_Utils_Type::T_STRING,
140 'title' => ts('Context') ,
141 'description' => 'Context for which name data pair is to be stored',
142 'required' => true,
143 'maxlength' => 255,
144 'size' => CRM_Utils_Type::HUGE,
145 ) ,
146 'name' => array(
147 'name' => 'name',
148 'type' => CRM_Utils_Type::T_STRING,
149 'title' => ts('Name') ,
150 'description' => 'Name of Context',
151 'required' => true,
152 'maxlength' => 255,
153 'size' => CRM_Utils_Type::HUGE,
154 ) ,
155 'data' => array(
156 'name' => 'data',
157 'type' => CRM_Utils_Type::T_LONGTEXT,
158 'title' => ts('Data') ,
159 'description' => 'data associated with name',
160 ) ,
161 'is_config' => array(
162 'name' => 'is_config',
163 'type' => CRM_Utils_Type::T_BOOLEAN,
164 'title' => ts('Is Configuration?') ,
165 'description' => 'Config Settings',
166 'required' => true,
167 ) ,
168 );
169 }
170 return self::$_fields;
171 }
172 /**
173 * Returns an array containing, for each field, the arary key used for that
174 * field in self::$_fields.
175 *
176 * @return array
177 */
178 static function &fieldKeys() {
179 if (!(self::$_fieldKeys)) {
180 self::$_fieldKeys = array(
181 'id' => 'id',
182 'context' => 'context',
183 'name' => 'name',
184 'data' => 'data',
185 'is_config' => 'is_config',
186 );
187 }
188 return self::$_fieldKeys;
189 }
190 /**
191 * Returns the names of this table
192 *
193 * @return string
194 */
195 static function getTableName() {
196 return self::$_tableName;
197 }
198 /**
199 * Returns if this table needs to be logged
200 *
201 * @return boolean
202 */
203 function getLog() {
204 return self::$_log;
205 }
206 /**
207 * Returns the list of fields that can be imported
208 *
209 * @param bool $prefix
210 *
211 * @return array
212 */
213 static function &import($prefix = false) {
214 if (!(self::$_import)) {
215 self::$_import = array();
216 $fields = self::fields();
217 foreach($fields as $name => $field) {
218 if (CRM_Utils_Array::value('import', $field)) {
219 if ($prefix) {
220 self::$_import['persistent'] = & $fields[$name];
221 } else {
222 self::$_import[$name] = & $fields[$name];
223 }
224 }
225 }
226 }
227 return self::$_import;
228 }
229 /**
230 * Returns the list of fields that can be exported
231 *
232 * @param bool $prefix
233 *
234 * @return array
235 */
236 static function &export($prefix = false) {
237 if (!(self::$_export)) {
238 self::$_export = array();
239 $fields = self::fields();
240 foreach($fields as $name => $field) {
241 if (CRM_Utils_Array::value('export', $field)) {
242 if ($prefix) {
243 self::$_export['persistent'] = & $fields[$name];
244 } else {
245 self::$_export[$name] = & $fields[$name];
246 }
247 }
248 }
249 }
250 return self::$_export;
251 }
252 }