Merge pull request #22298 from colemanw/fixApi3ValidateString
[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
2562d09a 9 * (GenCodeChecksum:fc7e6c978b71e38b5357cee46708a649)
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 {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '3.2';
c3fc2621 18
e501603b 19 /**
f41f0342 20 * Static instance to hold the table name.
e501603b
TO
21 *
22 * @var string
23 */
fa45b5b9 24 public static $_tableName = 'civicrm_address_format';
c3fc2621 25
e501603b 26 /**
f41f0342 27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 28 *
c3fc2621 29 * @var bool
e501603b 30 */
fa45b5b9 31 public static $_log = FALSE;
c3fc2621 32
e501603b 33 /**
2cbbebe8 34 * Address Format ID
e501603b 35 *
e6ca0a57 36 * @var int
e501603b
TO
37 */
38 public $id;
c3fc2621 39
e501603b
TO
40 /**
41 * The format of an address
42 *
43 * @var text
44 */
45 public $format;
c3fc2621 46
e501603b 47 /**
f41f0342 48 * Class constructor.
e501603b 49 */
c3fc2621 50 public function __construct() {
e501603b
TO
51 $this->__table = 'civicrm_address_format';
52 parent::__construct();
53 }
c3fc2621 54
449c4e6b
CW
55 /**
56 * Returns localized title of this entity.
7b66c3b5
AH
57 *
58 * @param bool $plural
59 * Whether to return the plural version of the title.
449c4e6b 60 */
7b66c3b5
AH
61 public static function getEntityTitle($plural = FALSE) {
62 return $plural ? ts('Address Formats') : ts('Address Format');
449c4e6b
CW
63 }
64
e501603b
TO
65 /**
66 * Returns all the column names of this table
67 *
68 * @return array
69 */
c3fc2621 70 public static function &fields() {
346aaaba 71 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
72 Civi::$statics[__CLASS__]['fields'] = [
73 'id' => [
e501603b
TO
74 'name' => 'id',
75 'type' => CRM_Utils_Type::T_INT,
c3fc2621 76 'title' => ts('Address Format ID'),
2cbbebe8 77 'description' => ts('Address Format ID'),
c3fc2621 78 'required' => TRUE,
a36434b9 79 'where' => 'civicrm_address_format.id',
522a26c9 80 'table_name' => 'civicrm_address_format',
81 'entity' => 'AddressFormat',
82 'bao' => 'CRM_Core_DAO_AddressFormat',
6a7e5e5d 83 'localizable' => 0,
2cbbebe8
A
84 'html' => [
85 'type' => 'Number',
86 ],
1fe423d6 87 'readonly' => TRUE,
a9d0587b 88 'add' => '3.2',
c3fc2621
CW
89 ],
90 'format' => [
e501603b
TO
91 'name' => 'format',
92 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 93 'title' => ts('Address Format'),
215b423e 94 'description' => ts('The format of an address'),
a36434b9 95 'where' => 'civicrm_address_format.format',
522a26c9 96 'table_name' => 'civicrm_address_format',
97 'entity' => 'AddressFormat',
98 'bao' => 'CRM_Core_DAO_AddressFormat',
6a7e5e5d 99 'localizable' => 0,
a9d0587b 100 'add' => '3.2',
c3fc2621
CW
101 ],
102 ];
346aaaba 103 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 104 }
346aaaba 105 return Civi::$statics[__CLASS__]['fields'];
e501603b 106 }
c3fc2621 107
e501603b 108 /**
bd8e0b14 109 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
110 *
111 * @return array
bd8e0b14 112 * Array(string $name => string $uniqueName).
e501603b 113 */
c3fc2621 114 public static function &fieldKeys() {
bd8e0b14
TO
115 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
116 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 117 }
bd8e0b14 118 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 119 }
c3fc2621 120
e501603b
TO
121 /**
122 * Returns the names of this table
123 *
124 * @return string
125 */
c3fc2621 126 public static function getTableName() {
e501603b
TO
127 return self::$_tableName;
128 }
c3fc2621 129
e501603b
TO
130 /**
131 * Returns if this table needs to be logged
132 *
c3fc2621 133 * @return bool
e501603b 134 */
c3fc2621 135 public function getLog() {
e501603b
TO
136 return self::$_log;
137 }
c3fc2621 138
e501603b
TO
139 /**
140 * Returns the list of fields that can be imported
141 *
142 * @param bool $prefix
143 *
144 * @return array
145 */
c3fc2621
CW
146 public static function &import($prefix = FALSE) {
147 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'address_format', $prefix, []);
60808919 148 return $r;
e501603b 149 }
c3fc2621 150
e501603b
TO
151 /**
152 * Returns the list of fields that can be exported
153 *
154 * @param bool $prefix
155 *
156 * @return array
157 */
c3fc2621
CW
158 public static function &export($prefix = FALSE) {
159 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'address_format', $prefix, []);
60808919 160 return $r;
e501603b 161 }
c3fc2621 162
e7a6b91a
AS
163 /**
164 * Returns the list of indices
c3fc2621
CW
165 *
166 * @param bool $localize
167 *
168 * @return array
e7a6b91a
AS
169 */
170 public static function indices($localize = TRUE) {
c3fc2621 171 $indices = [];
e7a6b91a
AS
172 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
173 }
c3fc2621 174
e501603b 175}