5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Contact/ContactType.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:0f7546e10f09f7637d50f7a34c632cb5)
13 * Database access object for the ContactType entity.
15 class CRM_Contact_DAO_ContactType
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '3.1';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_contact_type';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = FALSE;
41 * Internal name of Contact Type (or Subtype).
48 * localized Name of Contact Type.
55 * localized Optional verbose description of the type.
62 * URL of image if any.
69 * Optional FK to parent contact type.
76 * Is this entry active?
83 * Is this contact type a predefined system type
92 public function __construct() {
93 $this->__table
= 'civicrm_contact_type';
94 parent
::__construct();
98 * Returns localized title of this entity.
100 public static function getEntityTitle() {
101 return ts('Contact Types');
105 * Returns foreign keys and entity references.
108 * [CRM_Core_Reference_Interface]
110 public static function getReferenceColumns() {
111 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
112 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
113 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'parent_id', 'civicrm_contact_type', 'id');
114 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
116 return Civi
::$statics[__CLASS__
]['links'];
120 * Returns all the column names of this table
124 public static function &fields() {
125 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
126 Civi
::$statics[__CLASS__
]['fields'] = [
129 'type' => CRM_Utils_Type
::T_INT
,
130 'title' => ts('Contact Type ID'),
131 'description' => ts('Contact Type ID'),
133 'where' => 'civicrm_contact_type.id',
134 'table_name' => 'civicrm_contact_type',
135 'entity' => 'ContactType',
136 'bao' => 'CRM_Contact_BAO_ContactType',
142 'type' => CRM_Utils_Type
::T_STRING
,
143 'title' => ts('Name'),
144 'description' => ts('Internal name of Contact Type (or Subtype).'),
147 'size' => CRM_Utils_Type
::BIG
,
148 'where' => 'civicrm_contact_type.name',
149 'table_name' => 'civicrm_contact_type',
150 'entity' => 'ContactType',
151 'bao' => 'CRM_Contact_BAO_ContactType',
157 'type' => CRM_Utils_Type
::T_STRING
,
158 'title' => ts('Contact Type Label'),
159 'description' => ts('localized Name of Contact Type.'),
161 'size' => CRM_Utils_Type
::BIG
,
162 'where' => 'civicrm_contact_type.label',
163 'table_name' => 'civicrm_contact_type',
164 'entity' => 'ContactType',
165 'bao' => 'CRM_Contact_BAO_ContactType',
170 'name' => 'description',
171 'type' => CRM_Utils_Type
::T_TEXT
,
172 'title' => ts('Contact Type Description'),
173 'description' => ts('localized Optional verbose description of the type.'),
176 'where' => 'civicrm_contact_type.description',
177 'table_name' => 'civicrm_contact_type',
178 'entity' => 'ContactType',
179 'bao' => 'CRM_Contact_BAO_ContactType',
182 'type' => 'TextArea',
187 'name' => 'image_URL',
188 'type' => CRM_Utils_Type
::T_STRING
,
189 'title' => ts('Contact Type Image URL'),
190 'description' => ts('URL of image if any.'),
192 'size' => CRM_Utils_Type
::HUGE
,
193 'where' => 'civicrm_contact_type.image_URL',
194 'table_name' => 'civicrm_contact_type',
195 'entity' => 'ContactType',
196 'bao' => 'CRM_Contact_BAO_ContactType',
201 'name' => 'parent_id',
202 'type' => CRM_Utils_Type
::T_INT
,
203 'title' => ts('Contact Type Parent'),
204 'description' => ts('Optional FK to parent contact type.'),
205 'where' => 'civicrm_contact_type.parent_id',
206 'table_name' => 'civicrm_contact_type',
207 'entity' => 'ContactType',
208 'bao' => 'CRM_Contact_BAO_ContactType',
210 'FKClassName' => 'CRM_Contact_DAO_ContactType',
211 'pseudoconstant' => [
212 'table' => 'civicrm_contact_type',
214 'labelColumn' => 'label',
215 'condition' => 'parent_id IS NULL',
220 'name' => 'is_active',
221 'type' => CRM_Utils_Type
::T_BOOLEAN
,
222 'title' => ts('Contact Type Is Active?'),
223 'description' => ts('Is this entry active?'),
224 'where' => 'civicrm_contact_type.is_active',
226 'table_name' => 'civicrm_contact_type',
227 'entity' => 'ContactType',
228 'bao' => 'CRM_Contact_BAO_ContactType',
233 'name' => 'is_reserved',
234 'type' => CRM_Utils_Type
::T_BOOLEAN
,
235 'title' => ts('Contact Type is Reserved?'),
236 'description' => ts('Is this contact type a predefined system type'),
237 'where' => 'civicrm_contact_type.is_reserved',
239 'table_name' => 'civicrm_contact_type',
240 'entity' => 'ContactType',
241 'bao' => 'CRM_Contact_BAO_ContactType',
246 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
248 return Civi
::$statics[__CLASS__
]['fields'];
252 * Return a mapping from field-name to the corresponding key (as used in fields()).
255 * Array(string $name => string $uniqueName).
257 public static function &fieldKeys() {
258 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
259 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
261 return Civi
::$statics[__CLASS__
]['fieldKeys'];
265 * Returns the names of this table
269 public static function getTableName() {
270 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
274 * Returns if this table needs to be logged
278 public function getLog() {
283 * Returns the list of fields that can be imported
285 * @param bool $prefix
289 public static function &import($prefix = FALSE) {
290 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'contact_type', $prefix, []);
295 * Returns the list of fields that can be exported
297 * @param bool $prefix
301 public static function &export($prefix = FALSE) {
302 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'contact_type', $prefix, []);
307 * Returns the list of indices
309 * @param bool $localize
313 public static function indices($localize = TRUE) {
316 'name' => 'contact_type',
320 'localizable' => FALSE,
322 'sig' => 'civicrm_contact_type::1::name',
325 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;