API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[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:2b048fb746a5762a6e132fe7b1e8dd07)
10 */
11
12 /**
13 * Database access object for the Website entity.
14 */
15 class CRM_Core_DAO_Website extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_website';
23
24 /**
25 * Icon associated with this entity.
26 *
27 * @var string
28 */
29 public static $_icon = 'fa-desktop';
30
31 /**
32 * Should CiviCRM log any modifications to this table in the civicrm_log table.
33 *
34 * @var bool
35 */
36 public static $_log = FALSE;
37
38 /**
39 * Unique Website ID
40 *
41 * @var int
42 */
43 public $id;
44
45 /**
46 * FK to Contact ID
47 *
48 * @var int
49 */
50 public $contact_id;
51
52 /**
53 * Website
54 *
55 * @var string
56 */
57 public $url;
58
59 /**
60 * Which Website type does this website belong to.
61 *
62 * @var int
63 */
64 public $website_type_id;
65
66 /**
67 * Class constructor.
68 */
69 public function __construct() {
70 $this->__table = 'civicrm_website';
71 parent::__construct();
72 }
73
74 /**
75 * Returns localized title of this entity.
76 */
77 public static function getEntityTitle() {
78 return ts('Websites');
79 }
80
81 /**
82 * Returns foreign keys and entity references.
83 *
84 * @return array
85 * [CRM_Core_Reference_Interface]
86 */
87 public static function getReferenceColumns() {
88 if (!isset(Civi::$statics[__CLASS__]['links'])) {
89 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
90 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
91 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
92 }
93 return Civi::$statics[__CLASS__]['links'];
94 }
95
96 /**
97 * Returns all the column names of this table
98 *
99 * @return array
100 */
101 public static function &fields() {
102 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
103 Civi::$statics[__CLASS__]['fields'] = [
104 'id' => [
105 'name' => 'id',
106 'type' => CRM_Utils_Type::T_INT,
107 'title' => ts('Website ID'),
108 'description' => ts('Unique Website ID'),
109 'required' => TRUE,
110 'where' => 'civicrm_website.id',
111 'table_name' => 'civicrm_website',
112 'entity' => 'Website',
113 'bao' => 'CRM_Core_BAO_Website',
114 'localizable' => 0,
115 'add' => '3.2',
116 ],
117 'contact_id' => [
118 'name' => 'contact_id',
119 'type' => CRM_Utils_Type::T_INT,
120 'title' => ts('Contact'),
121 'description' => ts('FK to Contact ID'),
122 'where' => 'civicrm_website.contact_id',
123 'table_name' => 'civicrm_website',
124 'entity' => 'Website',
125 'bao' => 'CRM_Core_BAO_Website',
126 'localizable' => 0,
127 'FKClassName' => 'CRM_Contact_DAO_Contact',
128 'add' => '3.2',
129 ],
130 'url' => [
131 'name' => 'url',
132 'type' => CRM_Utils_Type::T_STRING,
133 'title' => ts('Website'),
134 'description' => ts('Website'),
135 'maxlength' => 128,
136 'size' => 30,
137 'import' => TRUE,
138 'where' => 'civicrm_website.url',
139 'headerPattern' => '/Website/i',
140 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/',
141 'export' => TRUE,
142 'table_name' => 'civicrm_website',
143 'entity' => 'Website',
144 'bao' => 'CRM_Core_BAO_Website',
145 'localizable' => 0,
146 'html' => [
147 'type' => 'Text',
148 ],
149 'add' => '3.2',
150 ],
151 'website_type_id' => [
152 'name' => 'website_type_id',
153 'type' => CRM_Utils_Type::T_INT,
154 'title' => ts('Website Type'),
155 'description' => ts('Which Website type does this website belong to.'),
156 'where' => 'civicrm_website.website_type_id',
157 'table_name' => 'civicrm_website',
158 'entity' => 'Website',
159 'bao' => 'CRM_Core_BAO_Website',
160 'localizable' => 0,
161 'html' => [
162 'type' => 'Select',
163 ],
164 'pseudoconstant' => [
165 'optionGroupName' => 'website_type',
166 'optionEditPath' => 'civicrm/admin/options/website_type',
167 ],
168 'add' => '3.2',
169 ],
170 ];
171 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
172 }
173 return Civi::$statics[__CLASS__]['fields'];
174 }
175
176 /**
177 * Return a mapping from field-name to the corresponding key (as used in fields()).
178 *
179 * @return array
180 * Array(string $name => string $uniqueName).
181 */
182 public static function &fieldKeys() {
183 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
184 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
185 }
186 return Civi::$statics[__CLASS__]['fieldKeys'];
187 }
188
189 /**
190 * Returns the names of this table
191 *
192 * @return string
193 */
194 public static function getTableName() {
195 return self::$_tableName;
196 }
197
198 /**
199 * Returns if this table needs to be logged
200 *
201 * @return bool
202 */
203 public function getLog() {
204 return self::$_log;
205 }
206
207 /**
208 * Returns the list of fields that can be imported
209 *
210 * @param bool $prefix
211 *
212 * @return array
213 */
214 public static function &import($prefix = FALSE) {
215 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'website', $prefix, []);
216 return $r;
217 }
218
219 /**
220 * Returns the list of fields that can be exported
221 *
222 * @param bool $prefix
223 *
224 * @return array
225 */
226 public static function &export($prefix = FALSE) {
227 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'website', $prefix, []);
228 return $r;
229 }
230
231 /**
232 * Returns the list of indices
233 *
234 * @param bool $localize
235 *
236 * @return array
237 */
238 public static function indices($localize = TRUE) {
239 $indices = [
240 'UI_website_type_id' => [
241 'name' => 'UI_website_type_id',
242 'field' => [
243 0 => 'website_type_id',
244 ],
245 'localizable' => FALSE,
246 'sig' => 'civicrm_website::0::website_type_id',
247 ],
248 ];
249 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
250 }
251
252 }