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