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:32038ad57ffa86a8e233d1d337d69f20)
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',
139 'type' => CRM_Utils_Type
::T_STRING
,
140 'title' => ts('Name'),
141 'description' => ts('Internal name of Contact Type (or Subtype).'),
144 'size' => CRM_Utils_Type
::BIG
,
145 'where' => 'civicrm_contact_type.name',
146 'table_name' => 'civicrm_contact_type',
147 'entity' => 'ContactType',
148 'bao' => 'CRM_Contact_BAO_ContactType',
153 'type' => CRM_Utils_Type
::T_STRING
,
154 'title' => ts('Contact Type Label'),
155 'description' => ts('localized Name of Contact Type.'),
157 'size' => CRM_Utils_Type
::BIG
,
158 'where' => 'civicrm_contact_type.label',
159 'table_name' => 'civicrm_contact_type',
160 'entity' => 'ContactType',
161 'bao' => 'CRM_Contact_BAO_ContactType',
165 'name' => 'description',
166 'type' => CRM_Utils_Type
::T_TEXT
,
167 'title' => ts('Contact Type Description'),
168 'description' => ts('localized Optional verbose description of the type.'),
171 'where' => 'civicrm_contact_type.description',
172 'table_name' => 'civicrm_contact_type',
173 'entity' => 'ContactType',
174 'bao' => 'CRM_Contact_BAO_ContactType',
177 'type' => 'TextArea',
181 'name' => 'image_URL',
182 'type' => CRM_Utils_Type
::T_STRING
,
183 'title' => ts('Contact Type Image URL'),
184 'description' => ts('URL of image if any.'),
186 'size' => CRM_Utils_Type
::HUGE
,
187 'where' => 'civicrm_contact_type.image_URL',
188 'table_name' => 'civicrm_contact_type',
189 'entity' => 'ContactType',
190 'bao' => 'CRM_Contact_BAO_ContactType',
194 'name' => 'parent_id',
195 'type' => CRM_Utils_Type
::T_INT
,
196 'title' => ts('Contact Type Parent'),
197 'description' => ts('Optional FK to parent contact type.'),
198 'where' => 'civicrm_contact_type.parent_id',
199 'table_name' => 'civicrm_contact_type',
200 'entity' => 'ContactType',
201 'bao' => 'CRM_Contact_BAO_ContactType',
203 'FKClassName' => 'CRM_Contact_DAO_ContactType',
204 'pseudoconstant' => [
205 'table' => 'civicrm_contact_type',
207 'labelColumn' => 'label',
208 'condition' => 'parent_id IS NULL',
212 'name' => 'is_active',
213 'type' => CRM_Utils_Type
::T_BOOLEAN
,
214 'title' => ts('Contact Type Is Active?'),
215 'description' => ts('Is this entry active?'),
216 'where' => 'civicrm_contact_type.is_active',
218 'table_name' => 'civicrm_contact_type',
219 'entity' => 'ContactType',
220 'bao' => 'CRM_Contact_BAO_ContactType',
224 'name' => 'is_reserved',
225 'type' => CRM_Utils_Type
::T_BOOLEAN
,
226 'title' => ts('Contact Type is Reserved?'),
227 'description' => ts('Is this contact type a predefined system type'),
228 'where' => 'civicrm_contact_type.is_reserved',
230 'table_name' => 'civicrm_contact_type',
231 'entity' => 'ContactType',
232 'bao' => 'CRM_Contact_BAO_ContactType',
236 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
238 return Civi
::$statics[__CLASS__
]['fields'];
242 * Return a mapping from field-name to the corresponding key (as used in fields()).
245 * Array(string $name => string $uniqueName).
247 public static function &fieldKeys() {
248 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
249 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
251 return Civi
::$statics[__CLASS__
]['fieldKeys'];
255 * Returns the names of this table
259 public static function getTableName() {
260 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
264 * Returns if this table needs to be logged
268 public function getLog() {
273 * Returns the list of fields that can be imported
275 * @param bool $prefix
279 public static function &import($prefix = FALSE) {
280 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'contact_type', $prefix, []);
285 * Returns the list of fields that can be exported
287 * @param bool $prefix
291 public static function &export($prefix = FALSE) {
292 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'contact_type', $prefix, []);
297 * Returns the list of indices
299 * @param bool $localize
303 public static function indices($localize = TRUE) {
306 'name' => 'contact_type',
310 'localizable' => FALSE,
312 'sig' => 'civicrm_contact_type::1::name',
315 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;