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