Merge pull request #9417 from ineffyble/CRM-19581
[civicrm-core.git] / CRM / Contact / DAO / ContactType.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
6| Copyright CiviCRM LLC (c) 2004-2016 |
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-2016
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';
37class CRM_Contact_DAO_ContactType extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_contact_type';
e501603b
TO
44 /**
45 * static value to see if we should log any modifications to
46 * this table in the civicrm_log table
47 *
48 * @var boolean
49 */
50 static $_log = false;
51 /**
52 * Contact Type ID
53 *
54 * @var int unsigned
55 */
56 public $id;
57 /**
58 * Internal name of Contact Type (or Subtype).
59 *
60 * @var string
61 */
62 public $name;
63 /**
64 * localized Name of Contact Type.
65 *
66 * @var string
67 */
68 public $label;
69 /**
70 * localized Optional verbose description of the type.
71 *
72 * @var text
73 */
74 public $description;
75 /**
76 * URL of image if any.
77 *
78 * @var string
79 */
80 public $image_URL;
81 /**
82 * Optional FK to parent contact type.
83 *
84 * @var int unsigned
85 */
86 public $parent_id;
87 /**
88 * Is this entry active?
89 *
90 * @var boolean
91 */
92 public $is_active;
93 /**
94 * Is this contact type a predefined system type
95 *
96 * @var boolean
97 */
98 public $is_reserved;
99 /**
100 * class constructor
101 *
102 * @return civicrm_contact_type
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() {
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}