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:ab123a55d492c003df354c32e8b9863c)
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 'table_name' => 'civicrm_contact_type',
125 'entity' => 'ContactType',
126 'bao' => 'CRM_Contact_BAO_ContactType',
131 'type' => CRM_Utils_Type
::T_STRING
,
132 'title' => ts('Name'),
133 'description' => ts('Internal name of Contact Type (or Subtype).'),
135 'size' => CRM_Utils_Type
::BIG
,
136 'table_name' => 'civicrm_contact_type',
137 'entity' => 'ContactType',
138 'bao' => 'CRM_Contact_BAO_ContactType',
143 'type' => CRM_Utils_Type
::T_STRING
,
144 'title' => ts('Contact Type Label'),
145 'description' => ts('localized Name of Contact Type.'),
147 'size' => CRM_Utils_Type
::BIG
,
148 'table_name' => 'civicrm_contact_type',
149 'entity' => 'ContactType',
150 'bao' => 'CRM_Contact_BAO_ContactType',
154 'name' => 'description',
155 'type' => CRM_Utils_Type
::T_TEXT
,
156 'title' => ts('Contact Type Description'),
157 'description' => ts('localized Optional verbose description of the type.'),
160 'table_name' => 'civicrm_contact_type',
161 'entity' => 'ContactType',
162 'bao' => 'CRM_Contact_BAO_ContactType',
165 'type' => 'TextArea',
169 'name' => 'image_URL',
170 'type' => CRM_Utils_Type
::T_STRING
,
171 'title' => ts('Contact Type Image URL'),
172 'description' => ts('URL of image if any.'),
174 'size' => CRM_Utils_Type
::HUGE
,
175 'table_name' => 'civicrm_contact_type',
176 'entity' => 'ContactType',
177 'bao' => 'CRM_Contact_BAO_ContactType',
181 'name' => 'parent_id',
182 'type' => CRM_Utils_Type
::T_INT
,
183 'title' => ts('Contact Type Parent'),
184 'description' => ts('Optional FK to parent contact type.'),
185 'table_name' => 'civicrm_contact_type',
186 'entity' => 'ContactType',
187 'bao' => 'CRM_Contact_BAO_ContactType',
189 'FKClassName' => 'CRM_Contact_DAO_ContactType',
190 'pseudoconstant' => [
191 'table' => 'civicrm_contact_type',
193 'labelColumn' => 'label',
194 'condition' => 'parent_id IS NULL',
198 'name' => 'is_active',
199 'type' => CRM_Utils_Type
::T_BOOLEAN
,
200 'title' => ts('Contact Type Is Active?'),
201 'description' => ts('Is this entry active?'),
202 'table_name' => 'civicrm_contact_type',
203 'entity' => 'ContactType',
204 'bao' => 'CRM_Contact_BAO_ContactType',
208 'name' => 'is_reserved',
209 'type' => CRM_Utils_Type
::T_BOOLEAN
,
210 'title' => ts('Contact Type is Reserved?'),
211 'description' => ts('Is this contact type a predefined system type'),
212 'table_name' => 'civicrm_contact_type',
213 'entity' => 'ContactType',
214 'bao' => 'CRM_Contact_BAO_ContactType',
218 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
220 return Civi
::$statics[__CLASS__
]['fields'];
224 * Return a mapping from field-name to the corresponding key (as used in fields()).
227 * Array(string $name => string $uniqueName).
229 public static function &fieldKeys() {
230 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
231 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
233 return Civi
::$statics[__CLASS__
]['fieldKeys'];
237 * Returns the names of this table
241 public static function getTableName() {
242 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
246 * Returns if this table needs to be logged
250 public function getLog() {
255 * Returns the list of fields that can be imported
257 * @param bool $prefix
261 public static function &import($prefix = FALSE) {
262 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'contact_type', $prefix, []);
267 * Returns the list of fields that can be exported
269 * @param bool $prefix
273 public static function &export($prefix = FALSE) {
274 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'contact_type', $prefix, []);
279 * Returns the list of indices
281 * @param bool $localize
285 public static function indices($localize = TRUE) {
288 'name' => 'contact_type',
292 'localizable' => FALSE,
294 'sig' => 'civicrm_contact_type::1::name',
297 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;