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:34f2ee23181ddce3050484b6e30b0e72)
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 localized title of this entity.
98 public static function getEntityTitle() {
99 return ts('Contact Types');
103 * Returns foreign keys and entity references.
106 * [CRM_Core_Reference_Interface]
108 public static function getReferenceColumns() {
109 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
110 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
111 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'parent_id', 'civicrm_contact_type', 'id');
112 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
114 return Civi
::$statics[__CLASS__
]['links'];
118 * Returns all the column names of this table
122 public static function &fields() {
123 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
124 Civi
::$statics[__CLASS__
]['fields'] = [
127 'type' => CRM_Utils_Type
::T_INT
,
128 'title' => ts('Contact Type ID'),
129 'description' => ts('Contact Type ID'),
131 'where' => 'civicrm_contact_type.id',
132 'table_name' => 'civicrm_contact_type',
133 'entity' => 'ContactType',
134 'bao' => 'CRM_Contact_BAO_ContactType',
140 'type' => CRM_Utils_Type
::T_STRING
,
141 'title' => ts('Name'),
142 'description' => ts('Internal name of Contact Type (or Subtype).'),
145 'size' => CRM_Utils_Type
::BIG
,
146 'where' => 'civicrm_contact_type.name',
147 'table_name' => 'civicrm_contact_type',
148 'entity' => 'ContactType',
149 'bao' => 'CRM_Contact_BAO_ContactType',
155 'type' => CRM_Utils_Type
::T_STRING
,
156 'title' => ts('Contact Type Label'),
157 'description' => ts('localized Name of Contact Type.'),
159 'size' => CRM_Utils_Type
::BIG
,
160 'where' => 'civicrm_contact_type.label',
161 'table_name' => 'civicrm_contact_type',
162 'entity' => 'ContactType',
163 'bao' => 'CRM_Contact_BAO_ContactType',
168 'name' => 'description',
169 'type' => CRM_Utils_Type
::T_TEXT
,
170 'title' => ts('Contact Type Description'),
171 'description' => ts('localized Optional verbose description of the type.'),
174 'where' => 'civicrm_contact_type.description',
175 'table_name' => 'civicrm_contact_type',
176 'entity' => 'ContactType',
177 'bao' => 'CRM_Contact_BAO_ContactType',
180 'type' => 'TextArea',
185 'name' => 'image_URL',
186 'type' => CRM_Utils_Type
::T_STRING
,
187 'title' => ts('Contact Type Image URL'),
188 'description' => ts('URL of image if any.'),
190 'size' => CRM_Utils_Type
::HUGE
,
191 'where' => 'civicrm_contact_type.image_URL',
192 'table_name' => 'civicrm_contact_type',
193 'entity' => 'ContactType',
194 'bao' => 'CRM_Contact_BAO_ContactType',
199 'name' => 'parent_id',
200 'type' => CRM_Utils_Type
::T_INT
,
201 'title' => ts('Contact Type Parent'),
202 'description' => ts('Optional FK to parent contact type.'),
203 'where' => 'civicrm_contact_type.parent_id',
204 'table_name' => 'civicrm_contact_type',
205 'entity' => 'ContactType',
206 'bao' => 'CRM_Contact_BAO_ContactType',
208 'FKClassName' => 'CRM_Contact_DAO_ContactType',
209 'pseudoconstant' => [
210 'table' => 'civicrm_contact_type',
212 'labelColumn' => 'label',
213 'condition' => 'parent_id IS NULL',
218 'name' => 'is_active',
219 'type' => CRM_Utils_Type
::T_BOOLEAN
,
220 'title' => ts('Contact Type Is Active?'),
221 'description' => ts('Is this entry active?'),
222 'where' => 'civicrm_contact_type.is_active',
224 'table_name' => 'civicrm_contact_type',
225 'entity' => 'ContactType',
226 'bao' => 'CRM_Contact_BAO_ContactType',
231 'name' => 'is_reserved',
232 'type' => CRM_Utils_Type
::T_BOOLEAN
,
233 'title' => ts('Contact Type is Reserved?'),
234 'description' => ts('Is this contact type a predefined system type'),
235 'where' => 'civicrm_contact_type.is_reserved',
237 'table_name' => 'civicrm_contact_type',
238 'entity' => 'ContactType',
239 'bao' => 'CRM_Contact_BAO_ContactType',
244 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
246 return Civi
::$statics[__CLASS__
]['fields'];
250 * Return a mapping from field-name to the corresponding key (as used in fields()).
253 * Array(string $name => string $uniqueName).
255 public static function &fieldKeys() {
256 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
257 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
259 return Civi
::$statics[__CLASS__
]['fieldKeys'];
263 * Returns the names of this table
267 public static function getTableName() {
268 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
272 * Returns if this table needs to be logged
276 public function getLog() {
281 * Returns the list of fields that can be imported
283 * @param bool $prefix
287 public static function &import($prefix = FALSE) {
288 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'contact_type', $prefix, []);
293 * Returns the list of fields that can be exported
295 * @param bool $prefix
299 public static function &export($prefix = FALSE) {
300 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'contact_type', $prefix, []);
305 * Returns the list of indices
307 * @param bool $localize
311 public static function indices($localize = TRUE) {
314 'name' => 'contact_type',
318 'localizable' => FALSE,
320 'sig' => 'civicrm_contact_type::1::name',
323 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;