CRM-20312 Add indices to DAO classes
[civicrm-core.git] / CRM / Core / DAO / LocBlock.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/LocBlock.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
022785d8 33 * (GenCodeChecksum:0782115dac3b6bb5e8a0291ddf5285ba)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
f41f0342 37/**
38 * CRM_Core_DAO_LocBlock constructor.
39 */
e501603b
TO
40class CRM_Core_DAO_LocBlock 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_loc_block';
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 = true;
53 /**
54 * Unique ID
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 *
61 * @var int unsigned
62 */
63 public $address_id;
64 /**
65 *
66 * @var int unsigned
67 */
68 public $email_id;
69 /**
70 *
71 * @var int unsigned
72 */
73 public $phone_id;
74 /**
75 *
76 * @var int unsigned
77 */
78 public $im_id;
79 /**
80 *
81 * @var int unsigned
82 */
83 public $address_2_id;
84 /**
85 *
86 * @var int unsigned
87 */
88 public $email_2_id;
89 /**
90 *
91 * @var int unsigned
92 */
93 public $phone_2_id;
94 /**
95 *
96 * @var int unsigned
97 */
98 public $im_2_id;
99 /**
f41f0342 100 * Class constructor.
e501603b
TO
101 */
102 function __construct() {
103 $this->__table = 'civicrm_loc_block';
104 parent::__construct();
105 }
106 /**
f41f0342 107 * Returns foreign keys and entity references.
e501603b
TO
108 *
109 * @return array
110 * [CRM_Core_Reference_Interface]
111 */
112 static function getReferenceColumns() {
346aaaba
TO
113 if (!isset(Civi::$statics[__CLASS__]['links'])) {
114 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
115 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'address_id', 'civicrm_address', 'id');
116 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'email_id', 'civicrm_email', 'id');
117 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'phone_id', 'civicrm_phone', 'id');
118 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'im_id', 'civicrm_im', 'id');
119 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'address_2_id', 'civicrm_address', 'id');
120 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'email_2_id', 'civicrm_email', 'id');
121 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'phone_2_id', 'civicrm_phone', 'id');
122 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'im_2_id', 'civicrm_im', 'id');
123 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 124 }
346aaaba 125 return Civi::$statics[__CLASS__]['links'];
e501603b
TO
126 }
127 /**
128 * Returns all the column names of this table
129 *
130 * @return array
131 */
132 static function &fields() {
346aaaba
TO
133 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
134 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
135 'id' => array(
136 'name' => 'id',
137 'type' => CRM_Utils_Type::T_INT,
138 'title' => ts('Location Block ID') ,
139 'description' => 'Unique ID',
140 'required' => true,
522a26c9 141 'table_name' => 'civicrm_loc_block',
142 'entity' => 'LocBlock',
143 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 144 'localizable' => 0,
e501603b
TO
145 ) ,
146 'address_id' => array(
147 'name' => 'address_id',
148 'type' => CRM_Utils_Type::T_INT,
149 'title' => ts('Location Block Address') ,
522a26c9 150 'table_name' => 'civicrm_loc_block',
151 'entity' => 'LocBlock',
152 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 153 'localizable' => 0,
e501603b
TO
154 'FKClassName' => 'CRM_Core_DAO_Address',
155 ) ,
156 'email_id' => array(
157 'name' => 'email_id',
158 'type' => CRM_Utils_Type::T_INT,
159 'title' => ts('Location Block Email') ,
522a26c9 160 'table_name' => 'civicrm_loc_block',
161 'entity' => 'LocBlock',
162 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 163 'localizable' => 0,
e501603b
TO
164 'FKClassName' => 'CRM_Core_DAO_Email',
165 ) ,
166 'phone_id' => array(
167 'name' => 'phone_id',
168 'type' => CRM_Utils_Type::T_INT,
169 'title' => ts('Location Block Phone') ,
522a26c9 170 'table_name' => 'civicrm_loc_block',
171 'entity' => 'LocBlock',
172 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 173 'localizable' => 0,
e501603b
TO
174 'FKClassName' => 'CRM_Core_DAO_Phone',
175 ) ,
176 'im_id' => array(
177 'name' => 'im_id',
178 'type' => CRM_Utils_Type::T_INT,
179 'title' => ts('Location Block IM') ,
522a26c9 180 'table_name' => 'civicrm_loc_block',
181 'entity' => 'LocBlock',
182 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 183 'localizable' => 0,
e501603b
TO
184 'FKClassName' => 'CRM_Core_DAO_IM',
185 ) ,
186 'address_2_id' => array(
187 'name' => 'address_2_id',
188 'type' => CRM_Utils_Type::T_INT,
189 'title' => ts('Location Block IM 2') ,
522a26c9 190 'table_name' => 'civicrm_loc_block',
191 'entity' => 'LocBlock',
192 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 193 'localizable' => 0,
e501603b
TO
194 'FKClassName' => 'CRM_Core_DAO_Address',
195 ) ,
196 'email_2_id' => array(
197 'name' => 'email_2_id',
198 'type' => CRM_Utils_Type::T_INT,
199 'title' => ts('Email 2') ,
522a26c9 200 'table_name' => 'civicrm_loc_block',
201 'entity' => 'LocBlock',
202 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 203 'localizable' => 0,
e501603b
TO
204 'FKClassName' => 'CRM_Core_DAO_Email',
205 ) ,
206 'phone_2_id' => array(
207 'name' => 'phone_2_id',
208 'type' => CRM_Utils_Type::T_INT,
209 'title' => ts('Phone 2') ,
522a26c9 210 'table_name' => 'civicrm_loc_block',
211 'entity' => 'LocBlock',
212 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 213 'localizable' => 0,
e501603b
TO
214 'FKClassName' => 'CRM_Core_DAO_Phone',
215 ) ,
216 'im_2_id' => array(
217 'name' => 'im_2_id',
218 'type' => CRM_Utils_Type::T_INT,
219 'title' => ts('Instant Messenger 2') ,
522a26c9 220 'table_name' => 'civicrm_loc_block',
221 'entity' => 'LocBlock',
222 'bao' => 'CRM_Core_DAO_LocBlock',
6a7e5e5d 223 'localizable' => 0,
e501603b
TO
224 'FKClassName' => 'CRM_Core_DAO_IM',
225 ) ,
226 );
346aaaba 227 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 228 }
346aaaba 229 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
230 }
231 /**
bd8e0b14 232 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
233 *
234 * @return array
bd8e0b14 235 * Array(string $name => string $uniqueName).
e501603b
TO
236 */
237 static function &fieldKeys() {
bd8e0b14
TO
238 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
239 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 240 }
bd8e0b14 241 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
242 }
243 /**
244 * Returns the names of this table
245 *
246 * @return string
247 */
248 static function getTableName() {
249 return self::$_tableName;
250 }
251 /**
252 * Returns if this table needs to be logged
253 *
254 * @return boolean
255 */
256 function getLog() {
257 return self::$_log;
258 }
259 /**
260 * Returns the list of fields that can be imported
261 *
262 * @param bool $prefix
263 *
264 * @return array
265 */
266 static function &import($prefix = false) {
60808919
TO
267 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'loc_block', $prefix, array());
268 return $r;
e501603b
TO
269 }
270 /**
271 * Returns the list of fields that can be exported
272 *
273 * @param bool $prefix
274 *
275 * @return array
276 */
277 static function &export($prefix = false) {
60808919
TO
278 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'loc_block', $prefix, array());
279 return $r;
e501603b
TO
280 }
281}