Merge pull request #22664 from braders/membershipview-default-values
[civicrm-core.git] / CRM / Core / DAO / Website.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/Website.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
28979d65 9 * (GenCodeChecksum:7ef66a990830d03a02dd59b7b6f0d2cb)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the Website entity.
f41f0342 14 */
e501603b 15class CRM_Core_DAO_Website 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_website';
c3fc2621 25
449c4e6b
CW
26 /**
27 * Icon associated with this entity.
28 *
29 * @var string
30 */
31 public static $_icon = 'fa-desktop';
32
8ab43c93
CW
33 /**
34 * Field to show when displaying a record.
35 *
36 * @var string
37 */
38 public static $_labelField = 'url';
39
e501603b 40 /**
f41f0342 41 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 42 *
c3fc2621 43 * @var bool
e501603b 44 */
fa45b5b9 45 public static $_log = FALSE;
c3fc2621 46
e501603b
TO
47 /**
48 * Unique Website ID
49 *
28979d65
CW
50 * @var int|string|null
51 * (SQL type: int unsigned)
52 * Note that values will be retrieved from the database as a string.
e501603b
TO
53 */
54 public $id;
c3fc2621 55
e501603b
TO
56 /**
57 * FK to Contact ID
58 *
28979d65
CW
59 * @var int|string|null
60 * (SQL type: int unsigned)
61 * Note that values will be retrieved from the database as a string.
e501603b
TO
62 */
63 public $contact_id;
c3fc2621 64
e501603b
TO
65 /**
66 * Website
67 *
28979d65
CW
68 * @var string|null
69 * (SQL type: varchar(128))
70 * Note that values will be retrieved from the database as a string.
e501603b
TO
71 */
72 public $url;
c3fc2621 73
e501603b
TO
74 /**
75 * Which Website type does this website belong to.
76 *
28979d65
CW
77 * @var int|string|null
78 * (SQL type: int unsigned)
79 * Note that values will be retrieved from the database as a string.
e501603b
TO
80 */
81 public $website_type_id;
c3fc2621 82
e501603b 83 /**
f41f0342 84 * Class constructor.
e501603b 85 */
c3fc2621 86 public function __construct() {
e501603b
TO
87 $this->__table = 'civicrm_website';
88 parent::__construct();
89 }
c3fc2621 90
449c4e6b
CW
91 /**
92 * Returns localized title of this entity.
7b66c3b5
AH
93 *
94 * @param bool $plural
95 * Whether to return the plural version of the title.
449c4e6b 96 */
7b66c3b5
AH
97 public static function getEntityTitle($plural = FALSE) {
98 return $plural ? ts('Websites') : ts('Website');
449c4e6b
CW
99 }
100
e501603b 101 /**
f41f0342 102 * Returns foreign keys and entity references.
e501603b
TO
103 *
104 * @return array
105 * [CRM_Core_Reference_Interface]
106 */
c3fc2621 107 public static function getReferenceColumns() {
346aaaba 108 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 109 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621 110 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
346aaaba 111 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 112 }
346aaaba 113 return Civi::$statics[__CLASS__]['links'];
e501603b 114 }
c3fc2621 115
e501603b
TO
116 /**
117 * Returns all the column names of this table
118 *
119 * @return array
120 */
c3fc2621 121 public static function &fields() {
346aaaba 122 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
123 Civi::$statics[__CLASS__]['fields'] = [
124 'id' => [
e501603b
TO
125 'name' => 'id',
126 'type' => CRM_Utils_Type::T_INT,
c3fc2621 127 'title' => ts('Website ID'),
215b423e 128 'description' => ts('Unique Website ID'),
c3fc2621 129 'required' => TRUE,
a36434b9 130 'where' => 'civicrm_website.id',
522a26c9 131 'table_name' => 'civicrm_website',
132 'entity' => 'Website',
133 'bao' => 'CRM_Core_BAO_Website',
6a7e5e5d 134 'localizable' => 0,
2cbbebe8
A
135 'html' => [
136 'type' => 'Number',
137 ],
1fe423d6 138 'readonly' => TRUE,
a9d0587b 139 'add' => '3.2',
c3fc2621
CW
140 ],
141 'contact_id' => [
e501603b
TO
142 'name' => 'contact_id',
143 'type' => CRM_Utils_Type::T_INT,
2cbbebe8 144 'title' => ts('Contact ID'),
215b423e 145 'description' => ts('FK to Contact ID'),
a36434b9 146 'where' => 'civicrm_website.contact_id',
522a26c9 147 'table_name' => 'civicrm_website',
148 'entity' => 'Website',
149 'bao' => 'CRM_Core_BAO_Website',
6a7e5e5d 150 'localizable' => 0,
e501603b 151 'FKClassName' => 'CRM_Contact_DAO_Contact',
2cbbebe8
A
152 'html' => [
153 'label' => ts("Contact"),
154 ],
a9d0587b 155 'add' => '3.2',
c3fc2621
CW
156 ],
157 'url' => [
e501603b
TO
158 'name' => 'url',
159 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 160 'title' => ts('Website'),
215b423e 161 'description' => ts('Website'),
e501603b
TO
162 'maxlength' => 128,
163 'size' => 30,
c3fc2621 164 'import' => TRUE,
e501603b
TO
165 'where' => 'civicrm_website.url',
166 'headerPattern' => '/Website/i',
167 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/',
c3fc2621 168 'export' => TRUE,
522a26c9 169 'table_name' => 'civicrm_website',
170 'entity' => 'Website',
171 'bao' => 'CRM_Core_BAO_Website',
6a7e5e5d 172 'localizable' => 0,
c3fc2621 173 'html' => [
e501603b 174 'type' => 'Text',
c3fc2621 175 ],
a9d0587b 176 'add' => '3.2',
c3fc2621
CW
177 ],
178 'website_type_id' => [
e501603b
TO
179 'name' => 'website_type_id',
180 'type' => CRM_Utils_Type::T_INT,
c3fc2621 181 'title' => ts('Website Type'),
215b423e 182 'description' => ts('Which Website type does this website belong to.'),
a36434b9 183 'where' => 'civicrm_website.website_type_id',
522a26c9 184 'table_name' => 'civicrm_website',
185 'entity' => 'Website',
186 'bao' => 'CRM_Core_BAO_Website',
6a7e5e5d 187 'localizable' => 0,
c3fc2621 188 'html' => [
e501603b 189 'type' => 'Select',
c3fc2621
CW
190 ],
191 'pseudoconstant' => [
e501603b
TO
192 'optionGroupName' => 'website_type',
193 'optionEditPath' => 'civicrm/admin/options/website_type',
e6ca0a57 194 ],
a9d0587b 195 'add' => '3.2',
c3fc2621
CW
196 ],
197 ];
346aaaba 198 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 199 }
346aaaba 200 return Civi::$statics[__CLASS__]['fields'];
e501603b 201 }
c3fc2621 202
e501603b 203 /**
bd8e0b14 204 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
205 *
206 * @return array
bd8e0b14 207 * Array(string $name => string $uniqueName).
e501603b 208 */
c3fc2621 209 public static function &fieldKeys() {
bd8e0b14
TO
210 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
211 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 212 }
bd8e0b14 213 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 214 }
c3fc2621 215
e501603b
TO
216 /**
217 * Returns the names of this table
218 *
219 * @return string
220 */
c3fc2621 221 public static function getTableName() {
e501603b
TO
222 return self::$_tableName;
223 }
c3fc2621 224
e501603b
TO
225 /**
226 * Returns if this table needs to be logged
227 *
c3fc2621 228 * @return bool
e501603b 229 */
c3fc2621 230 public function getLog() {
e501603b
TO
231 return self::$_log;
232 }
c3fc2621 233
e501603b
TO
234 /**
235 * Returns the list of fields that can be imported
236 *
237 * @param bool $prefix
238 *
239 * @return array
240 */
c3fc2621
CW
241 public static function &import($prefix = FALSE) {
242 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'website', $prefix, []);
60808919 243 return $r;
e501603b 244 }
c3fc2621 245
e501603b
TO
246 /**
247 * Returns the list of fields that can be exported
248 *
249 * @param bool $prefix
250 *
251 * @return array
252 */
c3fc2621
CW
253 public static function &export($prefix = FALSE) {
254 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'website', $prefix, []);
60808919 255 return $r;
e501603b 256 }
c3fc2621 257
e7a6b91a
AS
258 /**
259 * Returns the list of indices
c3fc2621
CW
260 *
261 * @param bool $localize
262 *
263 * @return array
e7a6b91a
AS
264 */
265 public static function indices($localize = TRUE) {
c3fc2621
CW
266 $indices = [
267 'UI_website_type_id' => [
e7a6b91a 268 'name' => 'UI_website_type_id',
c3fc2621 269 'field' => [
e7a6b91a 270 0 => 'website_type_id',
c3fc2621
CW
271 ],
272 'localizable' => FALSE,
e7a6b91a 273 'sig' => 'civicrm_website::0::website_type_id',
c3fc2621
CW
274 ],
275 ];
e7a6b91a
AS
276 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
277 }
c3fc2621 278
e501603b 279}