| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package CRM |
| 5 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
| 6 | * |
| 7 | * Generated from xml/schema/CRM/Core/LocationType.xml |
| 8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen |
| 9 | * (GenCodeChecksum:7bf7552cfdc3988c4582bccaea302c5f) |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * Database access object for the LocationType entity. |
| 14 | */ |
| 15 | class CRM_Core_DAO_LocationType extends CRM_Core_DAO { |
| 16 | const EXT = 'civicrm'; |
| 17 | const TABLE_ADDED = '1.1'; |
| 18 | |
| 19 | /** |
| 20 | * Static instance to hold the table name. |
| 21 | * |
| 22 | * @var string |
| 23 | */ |
| 24 | public static $_tableName = 'civicrm_location_type'; |
| 25 | |
| 26 | /** |
| 27 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
| 28 | * |
| 29 | * @var bool |
| 30 | */ |
| 31 | public static $_log = TRUE; |
| 32 | |
| 33 | /** |
| 34 | * Location Type ID |
| 35 | * |
| 36 | * @var int|string|null |
| 37 | * (SQL type: int unsigned) |
| 38 | * Note that values will be retrieved from the database as a string. |
| 39 | */ |
| 40 | public $id; |
| 41 | |
| 42 | /** |
| 43 | * Location Type Name. |
| 44 | * |
| 45 | * @var string|null |
| 46 | * (SQL type: varchar(64)) |
| 47 | * Note that values will be retrieved from the database as a string. |
| 48 | */ |
| 49 | public $name; |
| 50 | |
| 51 | /** |
| 52 | * Location Type Display Name. |
| 53 | * |
| 54 | * @var string|null |
| 55 | * (SQL type: varchar(64)) |
| 56 | * Note that values will be retrieved from the database as a string. |
| 57 | */ |
| 58 | public $display_name; |
| 59 | |
| 60 | /** |
| 61 | * vCard Location Type Name. |
| 62 | * |
| 63 | * @var string|null |
| 64 | * (SQL type: varchar(64)) |
| 65 | * Note that values will be retrieved from the database as a string. |
| 66 | */ |
| 67 | public $vcard_name; |
| 68 | |
| 69 | /** |
| 70 | * Location Type Description. |
| 71 | * |
| 72 | * @var string|null |
| 73 | * (SQL type: varchar(255)) |
| 74 | * Note that values will be retrieved from the database as a string. |
| 75 | */ |
| 76 | public $description; |
| 77 | |
| 78 | /** |
| 79 | * Is this location type a predefined system location? |
| 80 | * |
| 81 | * @var bool|string|null |
| 82 | * (SQL type: tinyint) |
| 83 | * Note that values will be retrieved from the database as a string. |
| 84 | */ |
| 85 | public $is_reserved; |
| 86 | |
| 87 | /** |
| 88 | * Is this property active? |
| 89 | * |
| 90 | * @var bool|string|null |
| 91 | * (SQL type: tinyint) |
| 92 | * Note that values will be retrieved from the database as a string. |
| 93 | */ |
| 94 | public $is_active; |
| 95 | |
| 96 | /** |
| 97 | * Is this location type the default? |
| 98 | * |
| 99 | * @var bool|string|null |
| 100 | * (SQL type: tinyint) |
| 101 | * Note that values will be retrieved from the database as a string. |
| 102 | */ |
| 103 | public $is_default; |
| 104 | |
| 105 | /** |
| 106 | * Class constructor. |
| 107 | */ |
| 108 | public function __construct() { |
| 109 | $this->__table = 'civicrm_location_type'; |
| 110 | parent::__construct(); |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * Returns localized title of this entity. |
| 115 | * |
| 116 | * @param bool $plural |
| 117 | * Whether to return the plural version of the title. |
| 118 | */ |
| 119 | public static function getEntityTitle($plural = FALSE) { |
| 120 | return $plural ? ts('Location Types') : ts('Location Type'); |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * Returns all the column names of this table |
| 125 | * |
| 126 | * @return array |
| 127 | */ |
| 128 | public static function &fields() { |
| 129 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
| 130 | Civi::$statics[__CLASS__]['fields'] = [ |
| 131 | 'id' => [ |
| 132 | 'name' => 'id', |
| 133 | 'type' => CRM_Utils_Type::T_INT, |
| 134 | 'title' => ts('Location Type ID'), |
| 135 | 'description' => ts('Location Type ID'), |
| 136 | 'required' => TRUE, |
| 137 | 'where' => 'civicrm_location_type.id', |
| 138 | 'table_name' => 'civicrm_location_type', |
| 139 | 'entity' => 'LocationType', |
| 140 | 'bao' => 'CRM_Core_BAO_LocationType', |
| 141 | 'localizable' => 0, |
| 142 | 'html' => [ |
| 143 | 'type' => 'Number', |
| 144 | ], |
| 145 | 'readonly' => TRUE, |
| 146 | 'add' => '1.1', |
| 147 | ], |
| 148 | 'name' => [ |
| 149 | 'name' => 'name', |
| 150 | 'type' => CRM_Utils_Type::T_STRING, |
| 151 | 'title' => ts('Location Type'), |
| 152 | 'description' => ts('Location Type Name.'), |
| 153 | 'maxlength' => 64, |
| 154 | 'size' => CRM_Utils_Type::BIG, |
| 155 | 'where' => 'civicrm_location_type.name', |
| 156 | 'table_name' => 'civicrm_location_type', |
| 157 | 'entity' => 'LocationType', |
| 158 | 'bao' => 'CRM_Core_BAO_LocationType', |
| 159 | 'localizable' => 0, |
| 160 | 'add' => '1.1', |
| 161 | ], |
| 162 | 'display_name' => [ |
| 163 | 'name' => 'display_name', |
| 164 | 'type' => CRM_Utils_Type::T_STRING, |
| 165 | 'title' => ts('Display Name'), |
| 166 | 'description' => ts('Location Type Display Name.'), |
| 167 | 'maxlength' => 64, |
| 168 | 'size' => CRM_Utils_Type::BIG, |
| 169 | 'where' => 'civicrm_location_type.display_name', |
| 170 | 'table_name' => 'civicrm_location_type', |
| 171 | 'entity' => 'LocationType', |
| 172 | 'bao' => 'CRM_Core_BAO_LocationType', |
| 173 | 'localizable' => 1, |
| 174 | 'add' => '4.1', |
| 175 | ], |
| 176 | 'vcard_name' => [ |
| 177 | 'name' => 'vcard_name', |
| 178 | 'type' => CRM_Utils_Type::T_STRING, |
| 179 | 'title' => ts('vCard Location Type'), |
| 180 | 'description' => ts('vCard Location Type Name.'), |
| 181 | 'maxlength' => 64, |
| 182 | 'size' => CRM_Utils_Type::BIG, |
| 183 | 'where' => 'civicrm_location_type.vcard_name', |
| 184 | 'table_name' => 'civicrm_location_type', |
| 185 | 'entity' => 'LocationType', |
| 186 | 'bao' => 'CRM_Core_BAO_LocationType', |
| 187 | 'localizable' => 0, |
| 188 | 'add' => '1.1', |
| 189 | ], |
| 190 | 'description' => [ |
| 191 | 'name' => 'description', |
| 192 | 'type' => CRM_Utils_Type::T_STRING, |
| 193 | 'title' => ts('Description'), |
| 194 | 'description' => ts('Location Type Description.'), |
| 195 | 'maxlength' => 255, |
| 196 | 'size' => CRM_Utils_Type::HUGE, |
| 197 | 'where' => 'civicrm_location_type.description', |
| 198 | 'table_name' => 'civicrm_location_type', |
| 199 | 'entity' => 'LocationType', |
| 200 | 'bao' => 'CRM_Core_BAO_LocationType', |
| 201 | 'localizable' => 0, |
| 202 | 'html' => [ |
| 203 | 'label' => ts("Description"), |
| 204 | ], |
| 205 | 'add' => '1.1', |
| 206 | ], |
| 207 | 'is_reserved' => [ |
| 208 | 'name' => 'is_reserved', |
| 209 | 'type' => CRM_Utils_Type::T_BOOLEAN, |
| 210 | 'title' => ts('Location Type is Reserved?'), |
| 211 | 'description' => ts('Is this location type a predefined system location?'), |
| 212 | 'where' => 'civicrm_location_type.is_reserved', |
| 213 | 'table_name' => 'civicrm_location_type', |
| 214 | 'entity' => 'LocationType', |
| 215 | 'bao' => 'CRM_Core_BAO_LocationType', |
| 216 | 'localizable' => 0, |
| 217 | 'add' => '1.1', |
| 218 | ], |
| 219 | 'is_active' => [ |
| 220 | 'name' => 'is_active', |
| 221 | 'type' => CRM_Utils_Type::T_BOOLEAN, |
| 222 | 'title' => ts('Location Type is Active?'), |
| 223 | 'description' => ts('Is this property active?'), |
| 224 | 'where' => 'civicrm_location_type.is_active', |
| 225 | 'table_name' => 'civicrm_location_type', |
| 226 | 'entity' => 'LocationType', |
| 227 | 'bao' => 'CRM_Core_BAO_LocationType', |
| 228 | 'localizable' => 0, |
| 229 | 'add' => '1.1', |
| 230 | ], |
| 231 | 'is_default' => [ |
| 232 | 'name' => 'is_default', |
| 233 | 'type' => CRM_Utils_Type::T_BOOLEAN, |
| 234 | 'title' => ts('Default Location Type?'), |
| 235 | 'description' => ts('Is this location type the default?'), |
| 236 | 'where' => 'civicrm_location_type.is_default', |
| 237 | 'table_name' => 'civicrm_location_type', |
| 238 | 'entity' => 'LocationType', |
| 239 | 'bao' => 'CRM_Core_BAO_LocationType', |
| 240 | 'localizable' => 0, |
| 241 | 'add' => '1.1', |
| 242 | ], |
| 243 | ]; |
| 244 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
| 245 | } |
| 246 | return Civi::$statics[__CLASS__]['fields']; |
| 247 | } |
| 248 | |
| 249 | /** |
| 250 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
| 251 | * |
| 252 | * @return array |
| 253 | * Array(string $name => string $uniqueName). |
| 254 | */ |
| 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())); |
| 258 | } |
| 259 | return Civi::$statics[__CLASS__]['fieldKeys']; |
| 260 | } |
| 261 | |
| 262 | /** |
| 263 | * Returns the names of this table |
| 264 | * |
| 265 | * @return string |
| 266 | */ |
| 267 | public static function getTableName() { |
| 268 | return CRM_Core_DAO::getLocaleTableName(self::$_tableName); |
| 269 | } |
| 270 | |
| 271 | /** |
| 272 | * Returns if this table needs to be logged |
| 273 | * |
| 274 | * @return bool |
| 275 | */ |
| 276 | public function getLog() { |
| 277 | return self::$_log; |
| 278 | } |
| 279 | |
| 280 | /** |
| 281 | * Returns the list of fields that can be imported |
| 282 | * |
| 283 | * @param bool $prefix |
| 284 | * |
| 285 | * @return array |
| 286 | */ |
| 287 | public static function &import($prefix = FALSE) { |
| 288 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'location_type', $prefix, []); |
| 289 | return $r; |
| 290 | } |
| 291 | |
| 292 | /** |
| 293 | * Returns the list of fields that can be exported |
| 294 | * |
| 295 | * @param bool $prefix |
| 296 | * |
| 297 | * @return array |
| 298 | */ |
| 299 | public static function &export($prefix = FALSE) { |
| 300 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'location_type', $prefix, []); |
| 301 | return $r; |
| 302 | } |
| 303 | |
| 304 | /** |
| 305 | * Returns the list of indices |
| 306 | * |
| 307 | * @param bool $localize |
| 308 | * |
| 309 | * @return array |
| 310 | */ |
| 311 | public static function indices($localize = TRUE) { |
| 312 | $indices = [ |
| 313 | 'UI_name' => [ |
| 314 | 'name' => 'UI_name', |
| 315 | 'field' => [ |
| 316 | 0 => 'name', |
| 317 | ], |
| 318 | 'localizable' => FALSE, |
| 319 | 'unique' => TRUE, |
| 320 | 'sig' => 'civicrm_location_type::1::name', |
| 321 | ], |
| 322 | ]; |
| 323 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
| 324 | } |
| 325 | |
| 326 | } |