Merge pull request #12925 from eileenmcnaughton/setting
[civicrm-core.git] / CRM / Core / DAO / Website.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
8c9251b3 5 * @copyright CiviCRM LLC (c) 2004-2018
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Core/Website.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
e7a6b91a 9 * (GenCodeChecksum:7f68af3a95bfdc5dc7421efef27c0511)
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 {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
22 static $_tableName = 'civicrm_website';
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 */
c3fc2621
CW
29 static $_log = FALSE;
30
e501603b
TO
31 /**
32 * Unique Website ID
33 *
34 * @var int unsigned
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * FK to Contact ID
40 *
41 * @var int unsigned
42 */
43 public $contact_id;
c3fc2621 44
e501603b
TO
45 /**
46 * Website
47 *
48 * @var string
49 */
50 public $url;
c3fc2621 51
e501603b
TO
52 /**
53 * Which Website type does this website belong to.
54 *
55 * @var int unsigned
56 */
57 public $website_type_id;
c3fc2621 58
e501603b 59 /**
f41f0342 60 * Class constructor.
e501603b 61 */
c3fc2621 62 public function __construct() {
e501603b
TO
63 $this->__table = 'civicrm_website';
64 parent::__construct();
65 }
c3fc2621 66
e501603b 67 /**
f41f0342 68 * Returns foreign keys and entity references.
e501603b
TO
69 *
70 * @return array
71 * [CRM_Core_Reference_Interface]
72 */
c3fc2621 73 public static function getReferenceColumns() {
346aaaba
TO
74 if (!isset(Civi::$statics[__CLASS__]['links'])) {
75 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
c3fc2621 76 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
346aaaba 77 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 78 }
346aaaba 79 return Civi::$statics[__CLASS__]['links'];
e501603b 80 }
c3fc2621 81
e501603b
TO
82 /**
83 * Returns all the column names of this table
84 *
85 * @return array
86 */
c3fc2621 87 public static function &fields() {
346aaaba 88 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
89 Civi::$statics[__CLASS__]['fields'] = [
90 'id' => [
e501603b
TO
91 'name' => 'id',
92 'type' => CRM_Utils_Type::T_INT,
c3fc2621 93 'title' => ts('Website ID'),
e501603b 94 'description' => 'Unique Website ID',
c3fc2621 95 'required' => TRUE,
522a26c9 96 'table_name' => 'civicrm_website',
97 'entity' => 'Website',
98 'bao' => 'CRM_Core_BAO_Website',
6a7e5e5d 99 'localizable' => 0,
c3fc2621
CW
100 ],
101 'contact_id' => [
e501603b
TO
102 'name' => 'contact_id',
103 'type' => CRM_Utils_Type::T_INT,
c3fc2621 104 'title' => ts('Contact'),
e501603b 105 'description' => 'FK to Contact ID',
522a26c9 106 'table_name' => 'civicrm_website',
107 'entity' => 'Website',
108 'bao' => 'CRM_Core_BAO_Website',
6a7e5e5d 109 'localizable' => 0,
e501603b 110 'FKClassName' => 'CRM_Contact_DAO_Contact',
c3fc2621
CW
111 ],
112 'url' => [
e501603b
TO
113 'name' => 'url',
114 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 115 'title' => ts('Website'),
e501603b
TO
116 'description' => 'Website',
117 'maxlength' => 128,
118 'size' => 30,
c3fc2621 119 'import' => TRUE,
e501603b
TO
120 'where' => 'civicrm_website.url',
121 'headerPattern' => '/Website/i',
122 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/',
c3fc2621 123 'export' => TRUE,
522a26c9 124 'table_name' => 'civicrm_website',
125 'entity' => 'Website',
126 'bao' => 'CRM_Core_BAO_Website',
6a7e5e5d 127 'localizable' => 0,
c3fc2621 128 'html' => [
e501603b 129 'type' => 'Text',
c3fc2621
CW
130 ],
131 ],
132 'website_type_id' => [
e501603b
TO
133 'name' => 'website_type_id',
134 'type' => CRM_Utils_Type::T_INT,
c3fc2621 135 'title' => ts('Website Type'),
e501603b 136 'description' => 'Which Website type does this website belong to.',
522a26c9 137 'table_name' => 'civicrm_website',
138 'entity' => 'Website',
139 'bao' => 'CRM_Core_BAO_Website',
6a7e5e5d 140 'localizable' => 0,
c3fc2621 141 'html' => [
e501603b 142 'type' => 'Select',
c3fc2621
CW
143 ],
144 'pseudoconstant' => [
e501603b
TO
145 'optionGroupName' => 'website_type',
146 'optionEditPath' => 'civicrm/admin/options/website_type',
c3fc2621
CW
147 ]
148 ],
149 ];
346aaaba 150 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 151 }
346aaaba 152 return Civi::$statics[__CLASS__]['fields'];
e501603b 153 }
c3fc2621 154
e501603b 155 /**
bd8e0b14 156 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
157 *
158 * @return array
bd8e0b14 159 * Array(string $name => string $uniqueName).
e501603b 160 */
c3fc2621 161 public static function &fieldKeys() {
bd8e0b14
TO
162 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
163 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 164 }
bd8e0b14 165 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 166 }
c3fc2621 167
e501603b
TO
168 /**
169 * Returns the names of this table
170 *
171 * @return string
172 */
c3fc2621 173 public static function getTableName() {
e501603b
TO
174 return self::$_tableName;
175 }
c3fc2621 176
e501603b
TO
177 /**
178 * Returns if this table needs to be logged
179 *
c3fc2621 180 * @return bool
e501603b 181 */
c3fc2621 182 public function getLog() {
e501603b
TO
183 return self::$_log;
184 }
c3fc2621 185
e501603b
TO
186 /**
187 * Returns the list of fields that can be imported
188 *
189 * @param bool $prefix
190 *
191 * @return array
192 */
c3fc2621
CW
193 public static function &import($prefix = FALSE) {
194 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'website', $prefix, []);
60808919 195 return $r;
e501603b 196 }
c3fc2621 197
e501603b
TO
198 /**
199 * Returns the list of fields that can be exported
200 *
201 * @param bool $prefix
202 *
203 * @return array
204 */
c3fc2621
CW
205 public static function &export($prefix = FALSE) {
206 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'website', $prefix, []);
60808919 207 return $r;
e501603b 208 }
c3fc2621 209
e7a6b91a
AS
210 /**
211 * Returns the list of indices
c3fc2621
CW
212 *
213 * @param bool $localize
214 *
215 * @return array
e7a6b91a
AS
216 */
217 public static function indices($localize = TRUE) {
c3fc2621
CW
218 $indices = [
219 'UI_website_type_id' => [
e7a6b91a 220 'name' => 'UI_website_type_id',
c3fc2621 221 'field' => [
e7a6b91a 222 0 => 'website_type_id',
c3fc2621
CW
223 ],
224 'localizable' => FALSE,
e7a6b91a 225 'sig' => 'civicrm_website::0::website_type_id',
c3fc2621
CW
226 ],
227 ];
e7a6b91a
AS
228 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
229 }
c3fc2621 230
e501603b 231}