Merge pull request #10549 from jitendrapurohit/CRM-20761
[civicrm-core.git] / CRM / Core / DAO / LocBlock.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
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-2017
30 *
31 * Generated from xml/schema/CRM/Core/LocBlock.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:0782115dac3b6bb5e8a0291ddf5285ba)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Core_DAO_LocBlock constructor.
39 */
40 class CRM_Core_DAO_LocBlock extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_loc_block';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
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 /**
100 * Class constructor.
101 */
102 function __construct() {
103 $this->__table = 'civicrm_loc_block';
104 parent::__construct();
105 }
106 /**
107 * Returns foreign keys and entity references.
108 *
109 * @return array
110 * [CRM_Core_Reference_Interface]
111 */
112 static function getReferenceColumns() {
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']);
124 }
125 return Civi::$statics[__CLASS__]['links'];
126 }
127 /**
128 * Returns all the column names of this table
129 *
130 * @return array
131 */
132 static function &fields() {
133 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
134 Civi::$statics[__CLASS__]['fields'] = array(
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,
141 'table_name' => 'civicrm_loc_block',
142 'entity' => 'LocBlock',
143 'bao' => 'CRM_Core_DAO_LocBlock',
144 'localizable' => 0,
145 ) ,
146 'address_id' => array(
147 'name' => 'address_id',
148 'type' => CRM_Utils_Type::T_INT,
149 'title' => ts('Location Block Address') ,
150 'table_name' => 'civicrm_loc_block',
151 'entity' => 'LocBlock',
152 'bao' => 'CRM_Core_DAO_LocBlock',
153 'localizable' => 0,
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') ,
160 'table_name' => 'civicrm_loc_block',
161 'entity' => 'LocBlock',
162 'bao' => 'CRM_Core_DAO_LocBlock',
163 'localizable' => 0,
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') ,
170 'table_name' => 'civicrm_loc_block',
171 'entity' => 'LocBlock',
172 'bao' => 'CRM_Core_DAO_LocBlock',
173 'localizable' => 0,
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') ,
180 'table_name' => 'civicrm_loc_block',
181 'entity' => 'LocBlock',
182 'bao' => 'CRM_Core_DAO_LocBlock',
183 'localizable' => 0,
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') ,
190 'table_name' => 'civicrm_loc_block',
191 'entity' => 'LocBlock',
192 'bao' => 'CRM_Core_DAO_LocBlock',
193 'localizable' => 0,
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') ,
200 'table_name' => 'civicrm_loc_block',
201 'entity' => 'LocBlock',
202 'bao' => 'CRM_Core_DAO_LocBlock',
203 'localizable' => 0,
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') ,
210 'table_name' => 'civicrm_loc_block',
211 'entity' => 'LocBlock',
212 'bao' => 'CRM_Core_DAO_LocBlock',
213 'localizable' => 0,
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') ,
220 'table_name' => 'civicrm_loc_block',
221 'entity' => 'LocBlock',
222 'bao' => 'CRM_Core_DAO_LocBlock',
223 'localizable' => 0,
224 'FKClassName' => 'CRM_Core_DAO_IM',
225 ) ,
226 );
227 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
228 }
229 return Civi::$statics[__CLASS__]['fields'];
230 }
231 /**
232 * Return a mapping from field-name to the corresponding key (as used in fields()).
233 *
234 * @return array
235 * Array(string $name => string $uniqueName).
236 */
237 static function &fieldKeys() {
238 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
239 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
240 }
241 return Civi::$statics[__CLASS__]['fieldKeys'];
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) {
267 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'loc_block', $prefix, array());
268 return $r;
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) {
278 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'loc_block', $prefix, array());
279 return $r;
280 }
281 /**
282 * Returns the list of indices
283 */
284 public static function indices($localize = TRUE) {
285 $indices = array();
286 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
287 }
288 }