CRM-19925 Add Entity data and date format data to fields array on DAO.
[civicrm-core.git] / CRM / Contact / DAO / ContactType.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/Contact/ContactType.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:5cd581b1cd8b3dc4f942b1612a1daff0)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
f41f0342 37/**
38 * CRM_Contact_DAO_ContactType constructor.
39 */
e501603b
TO
40class CRM_Contact_DAO_ContactType 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_contact_type';
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 * 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 /**
f41f0342 102 * Class constructor.
e501603b
TO
103 */
104 function __construct() {
105 $this->__table = 'civicrm_contact_type';
106 parent::__construct();
107 }
108 /**
f41f0342 109 * Returns foreign keys and entity references.
e501603b
TO
110 *
111 * @return array
112 * [CRM_Core_Reference_Interface]
113 */
114 static function getReferenceColumns() {
346aaaba
TO
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']);
e501603b 119 }
346aaaba 120 return Civi::$statics[__CLASS__]['links'];
e501603b
TO
121 }
122 /**
123 * Returns all the column names of this table
124 *
125 * @return array
126 */
127 static function &fields() {
346aaaba
TO
128 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
129 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
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 ) ,
137 'name' => array(
138 'name' => 'name',
139 'type' => CRM_Utils_Type::T_STRING,
140 'title' => ts('Name') ,
141 'description' => 'Internal name of Contact Type (or Subtype).',
142 'maxlength' => 64,
143 'size' => CRM_Utils_Type::BIG,
144 ) ,
145 'label' => array(
146 'name' => 'label',
147 'type' => CRM_Utils_Type::T_STRING,
148 'title' => ts('Contact Type Label') ,
149 'description' => 'localized Name of Contact Type.',
150 'maxlength' => 64,
151 'size' => CRM_Utils_Type::BIG,
152 ) ,
153 'description' => array(
154 'name' => 'description',
155 'type' => CRM_Utils_Type::T_TEXT,
156 'title' => ts('Contact Type Description') ,
157 'description' => 'localized Optional verbose description of the type.',
158 'rows' => 2,
159 'cols' => 60,
160 'html' => array(
161 'type' => 'TextArea',
162 ) ,
163 ) ,
164 'image_URL' => array(
165 'name' => 'image_URL',
166 'type' => CRM_Utils_Type::T_STRING,
167 'title' => ts('Contact Type Image URL') ,
168 'description' => 'URL of image if any.',
169 'maxlength' => 255,
170 'size' => CRM_Utils_Type::HUGE,
171 ) ,
172 'parent_id' => array(
173 'name' => 'parent_id',
174 'type' => CRM_Utils_Type::T_INT,
175 'title' => ts('Contact Type Parent') ,
176 'description' => 'Optional FK to parent contact type.',
177 'FKClassName' => 'CRM_Contact_DAO_ContactType',
178 'pseudoconstant' => array(
179 'table' => 'civicrm_contact_type',
180 'keyColumn' => 'id',
181 'labelColumn' => 'label',
182 'condition' => 'parent_id IS NULL',
183 )
184 ) ,
185 'is_active' => array(
186 'name' => 'is_active',
187 'type' => CRM_Utils_Type::T_BOOLEAN,
188 'title' => ts('Contact Type Is Active?') ,
189 'description' => 'Is this entry active?',
190 ) ,
191 'is_reserved' => array(
192 'name' => 'is_reserved',
193 'type' => CRM_Utils_Type::T_BOOLEAN,
194 'title' => ts('Contact Type is Reserved?') ,
195 'description' => 'Is this contact type a predefined system type',
196 ) ,
197 );
346aaaba 198 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 199 }
346aaaba 200 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
201 }
202 /**
bd8e0b14 203 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
204 *
205 * @return array
bd8e0b14 206 * Array(string $name => string $uniqueName).
e501603b
TO
207 */
208 static function &fieldKeys() {
bd8e0b14
TO
209 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
210 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 211 }
bd8e0b14 212 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
213 }
214 /**
215 * Returns the names of this table
216 *
217 * @return string
218 */
219 static function getTableName() {
220 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
221 }
222 /**
223 * Returns if this table needs to be logged
224 *
225 * @return boolean
226 */
227 function getLog() {
228 return self::$_log;
229 }
230 /**
231 * Returns the list of fields that can be imported
232 *
233 * @param bool $prefix
234 *
235 * @return array
236 */
237 static function &import($prefix = false) {
60808919
TO
238 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contact_type', $prefix, array());
239 return $r;
e501603b
TO
240 }
241 /**
242 * Returns the list of fields that can be exported
243 *
244 * @param bool $prefix
245 *
246 * @return array
247 */
248 static function &export($prefix = false) {
60808919
TO
249 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contact_type', $prefix, array());
250 return $r;
e501603b
TO
251 }
252}