Merge pull request #19093 from civicrm/5.32
[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
d31fb4e3 9 * (GenCodeChecksum:47ce2c9d196b195fda0a60eaac02f5d1)
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
TO
33 /**
34 * Address Format Id
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'),
215b423e 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,
a9d0587b 84 'add' => '3.2',
c3fc2621
CW
85 ],
86 'format' => [
e501603b
TO
87 'name' => 'format',
88 'type' => CRM_Utils_Type::T_TEXT,
c3fc2621 89 'title' => ts('Address Format'),
215b423e 90 'description' => ts('The format of an address'),
a36434b9 91 'where' => 'civicrm_address_format.format',
522a26c9 92 'table_name' => 'civicrm_address_format',
93 'entity' => 'AddressFormat',
94 'bao' => 'CRM_Core_DAO_AddressFormat',
6a7e5e5d 95 'localizable' => 0,
a9d0587b 96 'add' => '3.2',
c3fc2621
CW
97 ],
98 ];
346aaaba 99 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 100 }
346aaaba 101 return Civi::$statics[__CLASS__]['fields'];
e501603b 102 }
c3fc2621 103
e501603b 104 /**
bd8e0b14 105 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
106 *
107 * @return array
bd8e0b14 108 * Array(string $name => string $uniqueName).
e501603b 109 */
c3fc2621 110 public static function &fieldKeys() {
bd8e0b14
TO
111 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
112 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 113 }
bd8e0b14 114 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 115 }
c3fc2621 116
e501603b
TO
117 /**
118 * Returns the names of this table
119 *
120 * @return string
121 */
c3fc2621 122 public static function getTableName() {
e501603b
TO
123 return self::$_tableName;
124 }
c3fc2621 125
e501603b
TO
126 /**
127 * Returns if this table needs to be logged
128 *
c3fc2621 129 * @return bool
e501603b 130 */
c3fc2621 131 public function getLog() {
e501603b
TO
132 return self::$_log;
133 }
c3fc2621 134
e501603b
TO
135 /**
136 * Returns the list of fields that can be imported
137 *
138 * @param bool $prefix
139 *
140 * @return array
141 */
c3fc2621
CW
142 public static function &import($prefix = FALSE) {
143 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'address_format', $prefix, []);
60808919 144 return $r;
e501603b 145 }
c3fc2621 146
e501603b
TO
147 /**
148 * Returns the list of fields that can be exported
149 *
150 * @param bool $prefix
151 *
152 * @return array
153 */
c3fc2621
CW
154 public static function &export($prefix = FALSE) {
155 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'address_format', $prefix, []);
60808919 156 return $r;
e501603b 157 }
c3fc2621 158
e7a6b91a
AS
159 /**
160 * Returns the list of indices
c3fc2621
CW
161 *
162 * @param bool $localize
163 *
164 * @return array
e7a6b91a
AS
165 */
166 public static function indices($localize = TRUE) {
c3fc2621 167 $indices = [];
e7a6b91a
AS
168 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
169 }
c3fc2621 170
e501603b 171}