Set version to 4.7.19
[civicrm-core.git] / CRM / Contact / DAO / ContactType.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/Contact/ContactType.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:ab18da73e77c120a3b3797acdd86a312)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 /**
38 * CRM_Contact_DAO_ContactType constructor.
39 */
40 class CRM_Contact_DAO_ContactType extends CRM_Core_DAO {
41 /**
42 * Static instance to hold the table name.
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_contact_type';
47 /**
48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
49 *
50 * @var boolean
51 */
52 static $_log = false;
53 /**
54 * Contact Type ID
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * Internal name of Contact Type (or Subtype).
61 *
62 * @var string
63 */
64 public $name;
65 /**
66 * localized Name of Contact Type.
67 *
68 * @var string
69 */
70 public $label;
71 /**
72 * localized Optional verbose description of the type.
73 *
74 * @var text
75 */
76 public $description;
77 /**
78 * URL of image if any.
79 *
80 * @var string
81 */
82 public $image_URL;
83 /**
84 * Optional FK to parent contact type.
85 *
86 * @var int unsigned
87 */
88 public $parent_id;
89 /**
90 * Is this entry active?
91 *
92 * @var boolean
93 */
94 public $is_active;
95 /**
96 * Is this contact type a predefined system type
97 *
98 * @var boolean
99 */
100 public $is_reserved;
101 /**
102 * Class constructor.
103 */
104 function __construct() {
105 $this->__table = 'civicrm_contact_type';
106 parent::__construct();
107 }
108 /**
109 * Returns foreign keys and entity references.
110 *
111 * @return array
112 * [CRM_Core_Reference_Interface]
113 */
114 static function getReferenceColumns() {
115 if (!isset(Civi::$statics[__CLASS__]['links'])) {
116 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
117 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'parent_id', 'civicrm_contact_type', 'id');
118 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
119 }
120 return Civi::$statics[__CLASS__]['links'];
121 }
122 /**
123 * Returns all the column names of this table
124 *
125 * @return array
126 */
127 static function &fields() {
128 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
129 Civi::$statics[__CLASS__]['fields'] = array(
130 'id' => array(
131 'name' => 'id',
132 'type' => CRM_Utils_Type::T_INT,
133 'title' => ts('Contact Type ID') ,
134 'description' => 'Contact Type ID',
135 'required' => true,
136 'table_name' => 'civicrm_contact_type',
137 'entity' => 'ContactType',
138 'bao' => 'CRM_Contact_BAO_ContactType',
139 ) ,
140 'name' => array(
141 'name' => 'name',
142 'type' => CRM_Utils_Type::T_STRING,
143 'title' => ts('Name') ,
144 'description' => 'Internal name of Contact Type (or Subtype).',
145 'maxlength' => 64,
146 'size' => CRM_Utils_Type::BIG,
147 'table_name' => 'civicrm_contact_type',
148 'entity' => 'ContactType',
149 'bao' => 'CRM_Contact_BAO_ContactType',
150 ) ,
151 'label' => array(
152 'name' => 'label',
153 'type' => CRM_Utils_Type::T_STRING,
154 'title' => ts('Contact Type Label') ,
155 'description' => 'localized Name of Contact Type.',
156 'maxlength' => 64,
157 'size' => CRM_Utils_Type::BIG,
158 'table_name' => 'civicrm_contact_type',
159 'entity' => 'ContactType',
160 'bao' => 'CRM_Contact_BAO_ContactType',
161 ) ,
162 'description' => array(
163 'name' => 'description',
164 'type' => CRM_Utils_Type::T_TEXT,
165 'title' => ts('Contact Type Description') ,
166 'description' => 'localized Optional verbose description of the type.',
167 'rows' => 2,
168 'cols' => 60,
169 'table_name' => 'civicrm_contact_type',
170 'entity' => 'ContactType',
171 'bao' => 'CRM_Contact_BAO_ContactType',
172 'html' => array(
173 'type' => 'TextArea',
174 ) ,
175 ) ,
176 'image_URL' => array(
177 'name' => 'image_URL',
178 'type' => CRM_Utils_Type::T_STRING,
179 'title' => ts('Contact Type Image URL') ,
180 'description' => 'URL of image if any.',
181 'maxlength' => 255,
182 'size' => CRM_Utils_Type::HUGE,
183 'table_name' => 'civicrm_contact_type',
184 'entity' => 'ContactType',
185 'bao' => 'CRM_Contact_BAO_ContactType',
186 ) ,
187 'parent_id' => array(
188 'name' => 'parent_id',
189 'type' => CRM_Utils_Type::T_INT,
190 'title' => ts('Contact Type Parent') ,
191 'description' => 'Optional FK to parent contact type.',
192 'table_name' => 'civicrm_contact_type',
193 'entity' => 'ContactType',
194 'bao' => 'CRM_Contact_BAO_ContactType',
195 'FKClassName' => 'CRM_Contact_DAO_ContactType',
196 'pseudoconstant' => array(
197 'table' => 'civicrm_contact_type',
198 'keyColumn' => 'id',
199 'labelColumn' => 'label',
200 'condition' => 'parent_id IS NULL',
201 )
202 ) ,
203 'is_active' => array(
204 'name' => 'is_active',
205 'type' => CRM_Utils_Type::T_BOOLEAN,
206 'title' => ts('Contact Type Is Active?') ,
207 'description' => 'Is this entry active?',
208 'table_name' => 'civicrm_contact_type',
209 'entity' => 'ContactType',
210 'bao' => 'CRM_Contact_BAO_ContactType',
211 ) ,
212 'is_reserved' => array(
213 'name' => 'is_reserved',
214 'type' => CRM_Utils_Type::T_BOOLEAN,
215 'title' => ts('Contact Type is Reserved?') ,
216 'description' => 'Is this contact type a predefined system type',
217 'table_name' => 'civicrm_contact_type',
218 'entity' => 'ContactType',
219 'bao' => 'CRM_Contact_BAO_ContactType',
220 ) ,
221 );
222 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
223 }
224 return Civi::$statics[__CLASS__]['fields'];
225 }
226 /**
227 * Return a mapping from field-name to the corresponding key (as used in fields()).
228 *
229 * @return array
230 * Array(string $name => string $uniqueName).
231 */
232 static function &fieldKeys() {
233 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
234 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
235 }
236 return Civi::$statics[__CLASS__]['fieldKeys'];
237 }
238 /**
239 * Returns the names of this table
240 *
241 * @return string
242 */
243 static function getTableName() {
244 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
245 }
246 /**
247 * Returns if this table needs to be logged
248 *
249 * @return boolean
250 */
251 function getLog() {
252 return self::$_log;
253 }
254 /**
255 * Returns the list of fields that can be imported
256 *
257 * @param bool $prefix
258 *
259 * @return array
260 */
261 static function &import($prefix = false) {
262 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contact_type', $prefix, array());
263 return $r;
264 }
265 /**
266 * Returns the list of fields that can be exported
267 *
268 * @param bool $prefix
269 *
270 * @return array
271 */
272 static function &export($prefix = false) {
273 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contact_type', $prefix, array());
274 return $r;
275 }
276 }