Merge pull request #11742 from seanmadsen/NFC-CRM_PCP_Form_Event
[civicrm-core.git] / CRM / Contact / DAO / ContactType.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
8c9251b3 5 * @copyright CiviCRM LLC (c) 2004-2018
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Contact/ContactType.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
e7a6b91a 9 * (GenCodeChecksum:0323c01f0e0b176df66fe4fa02e0a342)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the ContactType entity.
f41f0342 14 */
e501603b 15class CRM_Contact_DAO_ContactType extends CRM_Core_DAO {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
22 static $_tableName = 'civicrm_contact_type';
c3fc2621 23
e501603b 24 /**
f41f0342 25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 26 *
c3fc2621 27 * @var bool
e501603b 28 */
c3fc2621
CW
29 static $_log = FALSE;
30
e501603b
TO
31 /**
32 * Contact Type ID
33 *
34 * @var int unsigned
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * Internal name of Contact Type (or Subtype).
40 *
41 * @var string
42 */
43 public $name;
c3fc2621 44
e501603b
TO
45 /**
46 * localized Name of Contact Type.
47 *
48 * @var string
49 */
50 public $label;
c3fc2621 51
e501603b
TO
52 /**
53 * localized Optional verbose description of the type.
54 *
55 * @var text
56 */
57 public $description;
c3fc2621 58
e501603b
TO
59 /**
60 * URL of image if any.
61 *
62 * @var string
63 */
64 public $image_URL;
c3fc2621 65
e501603b
TO
66 /**
67 * Optional FK to parent contact type.
68 *
69 * @var int unsigned
70 */
71 public $parent_id;
c3fc2621 72
e501603b
TO
73 /**
74 * Is this entry active?
75 *
76 * @var boolean
77 */
78 public $is_active;
c3fc2621 79
e501603b
TO
80 /**
81 * Is this contact type a predefined system type
82 *
83 * @var boolean
84 */
85 public $is_reserved;
c3fc2621 86
e501603b 87 /**
f41f0342 88 * Class constructor.
e501603b 89 */
c3fc2621 90 public function __construct() {
e501603b
TO
91 $this->__table = 'civicrm_contact_type';
92 parent::__construct();
93 }
c3fc2621 94
e501603b 95 /**
f41f0342 96 * Returns foreign keys and entity references.
e501603b
TO
97 *
98 * @return array
99 * [CRM_Core_Reference_Interface]
100 */
c3fc2621 101 public static function getReferenceColumns() {
346aaaba
TO
102 if (!isset(Civi::$statics[__CLASS__]['links'])) {
103 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
c3fc2621 104 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'parent_id', 'civicrm_contact_type', 'id');
346aaaba 105 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 106 }
346aaaba 107 return Civi::$statics[__CLASS__]['links'];
e501603b 108 }
c3fc2621 109
e501603b
TO
110 /**
111 * Returns all the column names of this table
112 *
113 * @return array
114 */
c3fc2621 115 public static function &fields() {
346aaaba 116 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
117 Civi::$statics[__CLASS__]['fields'] = [
118 'id' => [
e501603b
TO
119 'name' => 'id',
120 'type' => CRM_Utils_Type::T_INT,
c3fc2621 121 'title' => ts('Contact Type ID'),
e501603b 122 'description' => 'Contact Type ID',
c3fc2621 123 'required' => TRUE,
522a26c9 124 'table_name' => 'civicrm_contact_type',
125 'entity' => 'ContactType',
126 'bao' => 'CRM_Contact_BAO_ContactType',
6a7e5e5d 127 'localizable' => 0,
c3fc2621
CW
128 ],
129 'name' => [
e501603b
TO
130 'name' => 'name',
131 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 132 'title' => ts('Name'),
e501603b
TO
133 'description' => 'Internal name of Contact Type (or Subtype).',
134 'maxlength' => 64,
135 'size' => CRM_Utils_Type::BIG,
522a26c9 136 'table_name' => 'civicrm_contact_type',
137 'entity' => 'ContactType',
138 'bao' => 'CRM_Contact_BAO_ContactType',
6a7e5e5d 139 'localizable' => 0,
c3fc2621
CW
140 ],
141 'label' => [
e501603b
TO
142 'name' => 'label',
143 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 144 'title' => ts('Contact Type Label'),
e501603b
TO
145 'description' => 'localized Name of Contact Type.',
146 'maxlength' => 64,
147 'size' => CRM_Utils_Type::BIG,
522a26c9 148 'table_name' => 'civicrm_contact_type',
149 'entity' => 'ContactType',
150 'bao' => 'CRM_Contact_BAO_ContactType',
6a7e5e5d 151 'localizable' => 1,
c3fc2621
CW
152 ],
153 'description' => [
e501603b
TO
154 'name' => 'description',
155 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 156 'title' => ts('Contact Type Description'),
e501603b
TO
157 'description' => 'localized Optional verbose description of the type.',
158 'rows' => 2,
159 'cols' => 60,
522a26c9 160 'table_name' => 'civicrm_contact_type',
161 'entity' => 'ContactType',
162 'bao' => 'CRM_Contact_BAO_ContactType',
6a7e5e5d 163 'localizable' => 1,
c3fc2621 164 'html' => [
e501603b 165 'type' => 'TextArea',
c3fc2621
CW
166 ],
167 ],
168 'image_URL' => [
e501603b
TO
169 'name' => 'image_URL',
170 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 171 'title' => ts('Contact Type Image URL'),
e501603b
TO
172 'description' => 'URL of image if any.',
173 'maxlength' => 255,
174 'size' => CRM_Utils_Type::HUGE,
522a26c9 175 'table_name' => 'civicrm_contact_type',
176 'entity' => 'ContactType',
177 'bao' => 'CRM_Contact_BAO_ContactType',
6a7e5e5d 178 'localizable' => 0,
c3fc2621
CW
179 ],
180 'parent_id' => [
e501603b
TO
181 'name' => 'parent_id',
182 'type' => CRM_Utils_Type::T_INT,
c3fc2621 183 'title' => ts('Contact Type Parent'),
e501603b 184 'description' => 'Optional FK to parent contact type.',
522a26c9 185 'table_name' => 'civicrm_contact_type',
186 'entity' => 'ContactType',
187 'bao' => 'CRM_Contact_BAO_ContactType',
6a7e5e5d 188 'localizable' => 0,
e501603b 189 'FKClassName' => 'CRM_Contact_DAO_ContactType',
c3fc2621 190 'pseudoconstant' => [
e501603b
TO
191 'table' => 'civicrm_contact_type',
192 'keyColumn' => 'id',
193 'labelColumn' => 'label',
194 'condition' => 'parent_id IS NULL',
c3fc2621
CW
195 ]
196 ],
197 'is_active' => [
e501603b
TO
198 'name' => 'is_active',
199 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 200 'title' => ts('Contact Type Is Active?'),
e501603b 201 'description' => 'Is this entry active?',
522a26c9 202 'table_name' => 'civicrm_contact_type',
203 'entity' => 'ContactType',
204 'bao' => 'CRM_Contact_BAO_ContactType',
6a7e5e5d 205 'localizable' => 0,
c3fc2621
CW
206 ],
207 'is_reserved' => [
e501603b
TO
208 'name' => 'is_reserved',
209 'type' => CRM_Utils_Type::T_BOOLEAN,
c3fc2621 210 'title' => ts('Contact Type is Reserved?'),
e501603b 211 'description' => 'Is this contact type a predefined system type',
522a26c9 212 'table_name' => 'civicrm_contact_type',
213 'entity' => 'ContactType',
214 'bao' => 'CRM_Contact_BAO_ContactType',
6a7e5e5d 215 'localizable' => 0,
c3fc2621
CW
216 ],
217 ];
346aaaba 218 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 219 }
346aaaba 220 return Civi::$statics[__CLASS__]['fields'];
e501603b 221 }
c3fc2621 222
e501603b 223 /**
bd8e0b14 224 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
225 *
226 * @return array
bd8e0b14 227 * Array(string $name => string $uniqueName).
e501603b 228 */
c3fc2621 229 public static function &fieldKeys() {
bd8e0b14
TO
230 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
231 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 232 }
bd8e0b14 233 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 234 }
c3fc2621 235
e501603b
TO
236 /**
237 * Returns the names of this table
238 *
239 * @return string
240 */
c3fc2621 241 public static function getTableName() {
e501603b
TO
242 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
243 }
c3fc2621 244
e501603b
TO
245 /**
246 * Returns if this table needs to be logged
247 *
c3fc2621 248 * @return bool
e501603b 249 */
c3fc2621 250 public function getLog() {
e501603b
TO
251 return self::$_log;
252 }
c3fc2621 253
e501603b
TO
254 /**
255 * Returns the list of fields that can be imported
256 *
257 * @param bool $prefix
258 *
259 * @return array
260 */
c3fc2621
CW
261 public static function &import($prefix = FALSE) {
262 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contact_type', $prefix, []);
60808919 263 return $r;
e501603b 264 }
c3fc2621 265
e501603b
TO
266 /**
267 * Returns the list of fields that can be exported
268 *
269 * @param bool $prefix
270 *
271 * @return array
272 */
c3fc2621
CW
273 public static function &export($prefix = FALSE) {
274 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contact_type', $prefix, []);
60808919 275 return $r;
e501603b 276 }
c3fc2621 277
e7a6b91a
AS
278 /**
279 * Returns the list of indices
c3fc2621
CW
280 *
281 * @param bool $localize
282 *
283 * @return array
e7a6b91a
AS
284 */
285 public static function indices($localize = TRUE) {
c3fc2621
CW
286 $indices = [
287 'contact_type' => [
e7a6b91a 288 'name' => 'contact_type',
c3fc2621 289 'field' => [
e7a6b91a 290 0 => 'name',
c3fc2621
CW
291 ],
292 'localizable' => FALSE,
293 'unique' => TRUE,
e7a6b91a 294 'sig' => 'civicrm_contact_type::1::name',
c3fc2621
CW
295 ],
296 ];
e7a6b91a
AS
297 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
298 }
c3fc2621 299
e501603b 300}