5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Contact/ContactType.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:d96dfa7e002831e18c602df130626dbb)
13 * Database access object for the ContactType entity.
15 class CRM_Contact_DAO_ContactType
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_contact_type';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = FALSE;
39 * Internal name of Contact Type (or Subtype).
46 * localized Name of Contact Type.
53 * localized Optional verbose description of the type.
60 * URL of image if any.
67 * Optional FK to parent contact type.
74 * Is this entry active?
81 * Is this contact type a predefined system type
90 public function __construct() {
91 $this->__table
= 'civicrm_contact_type';
92 parent
::__construct();
96 * Returns foreign keys and entity references.
99 * [CRM_Core_Reference_Interface]
101 public static function getReferenceColumns() {
102 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
103 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
104 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'parent_id', 'civicrm_contact_type', 'id');
105 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
107 return Civi
::$statics[__CLASS__
]['links'];
111 * Returns all the column names of this table
115 public static function &fields() {
116 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
117 Civi
::$statics[__CLASS__
]['fields'] = [
120 'type' => CRM_Utils_Type
::T_INT
,
121 'title' => ts('Contact Type ID'),
122 'description' => ts('Contact Type ID'),
124 'where' => 'civicrm_contact_type.id',
125 'table_name' => 'civicrm_contact_type',
126 'entity' => 'ContactType',
127 'bao' => 'CRM_Contact_BAO_ContactType',
132 'type' => CRM_Utils_Type
::T_STRING
,
133 'title' => ts('Name'),
134 'description' => ts('Internal name of Contact Type (or Subtype).'),
136 'size' => CRM_Utils_Type
::BIG
,
137 'where' => 'civicrm_contact_type.name',
138 'table_name' => 'civicrm_contact_type',
139 'entity' => 'ContactType',
140 'bao' => 'CRM_Contact_BAO_ContactType',
145 'type' => CRM_Utils_Type
::T_STRING
,
146 'title' => ts('Contact Type Label'),
147 'description' => ts('localized Name of Contact Type.'),
149 'size' => CRM_Utils_Type
::BIG
,
150 'where' => 'civicrm_contact_type.label',
151 'table_name' => 'civicrm_contact_type',
152 'entity' => 'ContactType',
153 'bao' => 'CRM_Contact_BAO_ContactType',
157 'name' => 'description',
158 'type' => CRM_Utils_Type
::T_TEXT
,
159 'title' => ts('Contact Type Description'),
160 'description' => ts('localized Optional verbose description of the type.'),
163 'where' => 'civicrm_contact_type.description',
164 'table_name' => 'civicrm_contact_type',
165 'entity' => 'ContactType',
166 'bao' => 'CRM_Contact_BAO_ContactType',
169 'type' => 'TextArea',
173 'name' => 'image_URL',
174 'type' => CRM_Utils_Type
::T_STRING
,
175 'title' => ts('Contact Type Image URL'),
176 'description' => ts('URL of image if any.'),
178 'size' => CRM_Utils_Type
::HUGE
,
179 'where' => 'civicrm_contact_type.image_URL',
180 'table_name' => 'civicrm_contact_type',
181 'entity' => 'ContactType',
182 'bao' => 'CRM_Contact_BAO_ContactType',
186 'name' => 'parent_id',
187 'type' => CRM_Utils_Type
::T_INT
,
188 'title' => ts('Contact Type Parent'),
189 'description' => ts('Optional FK to parent contact type.'),
190 'where' => 'civicrm_contact_type.parent_id',
191 'table_name' => 'civicrm_contact_type',
192 'entity' => 'ContactType',
193 'bao' => 'CRM_Contact_BAO_ContactType',
195 'FKClassName' => 'CRM_Contact_DAO_ContactType',
196 'pseudoconstant' => [
197 'table' => 'civicrm_contact_type',
199 'labelColumn' => 'label',
200 'condition' => 'parent_id IS NULL',
204 'name' => 'is_active',
205 'type' => CRM_Utils_Type
::T_BOOLEAN
,
206 'title' => ts('Contact Type Is Active?'),
207 'description' => ts('Is this entry active?'),
208 'where' => 'civicrm_contact_type.is_active',
209 'table_name' => 'civicrm_contact_type',
210 'entity' => 'ContactType',
211 'bao' => 'CRM_Contact_BAO_ContactType',
215 'name' => 'is_reserved',
216 'type' => CRM_Utils_Type
::T_BOOLEAN
,
217 'title' => ts('Contact Type is Reserved?'),
218 'description' => ts('Is this contact type a predefined system type'),
219 'where' => 'civicrm_contact_type.is_reserved',
220 'table_name' => 'civicrm_contact_type',
221 'entity' => 'ContactType',
222 'bao' => 'CRM_Contact_BAO_ContactType',
226 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
228 return Civi
::$statics[__CLASS__
]['fields'];
232 * Return a mapping from field-name to the corresponding key (as used in fields()).
235 * Array(string $name => string $uniqueName).
237 public static function &fieldKeys() {
238 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
239 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
241 return Civi
::$statics[__CLASS__
]['fieldKeys'];
245 * Returns the names of this table
249 public static function getTableName() {
250 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
254 * Returns if this table needs to be logged
258 public function getLog() {
263 * Returns the list of fields that can be imported
265 * @param bool $prefix
269 public static function &import($prefix = FALSE) {
270 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'contact_type', $prefix, []);
275 * Returns the list of fields that can be exported
277 * @param bool $prefix
281 public static function &export($prefix = FALSE) {
282 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'contact_type', $prefix, []);
287 * Returns the list of indices
289 * @param bool $localize
293 public static function indices($localize = TRUE) {
296 'name' => 'contact_type',
300 'localizable' => FALSE,
302 'sig' => 'civicrm_contact_type::1::name',
305 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;