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