API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[civicrm-core.git] / CRM / Core / DAO / AddressFormat.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/AddressFormat.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
a9d0587b 9 * (GenCodeChecksum:bd005804e8f957b74c4eafacea35792d)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the AddressFormat entity.
f41f0342 14 */
e501603b 15class CRM_Core_DAO_AddressFormat extends CRM_Core_DAO {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
fa45b5b9 22 public static $_tableName = 'civicrm_address_format';
c3fc2621 23
e501603b 24 /**
f41f0342 25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 26 *
c3fc2621 27 * @var bool
e501603b 28 */
fa45b5b9 29 public static $_log = FALSE;
c3fc2621 30
e501603b
TO
31 /**
32 * Address Format Id
33 *
e6ca0a57 34 * @var int
e501603b
TO
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * The format of an address
40 *
41 * @var text
42 */
43 public $format;
c3fc2621 44
e501603b 45 /**
f41f0342 46 * Class constructor.
e501603b 47 */
c3fc2621 48 public function __construct() {
e501603b
TO
49 $this->__table = 'civicrm_address_format';
50 parent::__construct();
51 }
c3fc2621 52
449c4e6b
CW
53 /**
54 * Returns localized title of this entity.
55 */
56 public static function getEntityTitle() {
57 return ts('Address Formats');
58 }
59
e501603b
TO
60 /**
61 * Returns all the column names of this table
62 *
63 * @return array
64 */
c3fc2621 65 public static function &fields() {
346aaaba 66 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
67 Civi::$statics[__CLASS__]['fields'] = [
68 'id' => [
e501603b
TO
69 'name' => 'id',
70 'type' => CRM_Utils_Type::T_INT,
c3fc2621 71 'title' => ts('Address Format ID'),
215b423e 72 'description' => ts('Address Format Id'),
c3fc2621 73 'required' => TRUE,
a36434b9 74 'where' => 'civicrm_address_format.id',
522a26c9 75 'table_name' => 'civicrm_address_format',
76 'entity' => 'AddressFormat',
77 'bao' => 'CRM_Core_DAO_AddressFormat',
6a7e5e5d 78 'localizable' => 0,
a9d0587b 79 'add' => '3.2',
c3fc2621
CW
80 ],
81 'format' => [
e501603b
TO
82 'name' => 'format',
83 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 84 'title' => ts('Address Format'),
215b423e 85 'description' => ts('The format of an address'),
a36434b9 86 'where' => 'civicrm_address_format.format',
522a26c9 87 'table_name' => 'civicrm_address_format',
88 'entity' => 'AddressFormat',
89 'bao' => 'CRM_Core_DAO_AddressFormat',
6a7e5e5d 90 'localizable' => 0,
a9d0587b 91 'add' => '3.2',
c3fc2621
CW
92 ],
93 ];
346aaaba 94 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 95 }
346aaaba 96 return Civi::$statics[__CLASS__]['fields'];
e501603b 97 }
c3fc2621 98
e501603b 99 /**
bd8e0b14 100 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
101 *
102 * @return array
bd8e0b14 103 * Array(string $name => string $uniqueName).
e501603b 104 */
c3fc2621 105 public static function &fieldKeys() {
bd8e0b14
TO
106 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
107 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 108 }
bd8e0b14 109 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 110 }
c3fc2621 111
e501603b
TO
112 /**
113 * Returns the names of this table
114 *
115 * @return string
116 */
c3fc2621 117 public static function getTableName() {
e501603b
TO
118 return self::$_tableName;
119 }
c3fc2621 120
e501603b
TO
121 /**
122 * Returns if this table needs to be logged
123 *
c3fc2621 124 * @return bool
e501603b 125 */
c3fc2621 126 public function getLog() {
e501603b
TO
127 return self::$_log;
128 }
c3fc2621 129
e501603b
TO
130 /**
131 * Returns the list of fields that can be imported
132 *
133 * @param bool $prefix
134 *
135 * @return array
136 */
c3fc2621
CW
137 public static function &import($prefix = FALSE) {
138 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'address_format', $prefix, []);
60808919 139 return $r;
e501603b 140 }
c3fc2621 141
e501603b
TO
142 /**
143 * Returns the list of fields that can be exported
144 *
145 * @param bool $prefix
146 *
147 * @return array
148 */
c3fc2621
CW
149 public static function &export($prefix = FALSE) {
150 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'address_format', $prefix, []);
60808919 151 return $r;
e501603b 152 }
c3fc2621 153
e7a6b91a
AS
154 /**
155 * Returns the list of indices
c3fc2621
CW
156 *
157 * @param bool $localize
158 *
159 * @return array
e7a6b91a
AS
160 */
161 public static function indices($localize = TRUE) {
c3fc2621 162 $indices = [];
e7a6b91a
AS
163 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
164 }
c3fc2621 165
e501603b 166}