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