Merge pull request #13241 from seamuslee001/561_schedule_reminders
[civicrm-core.git] / CRM / Core / DAO / Website.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Core/Website.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:3c7acea3980658a252658fd11578cfbe)
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 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 static $_log = FALSE;
30
31 /**
32 * Unique Website ID
33 *
34 * @var int unsigned
35 */
36 public $id;
37
38 /**
39 * FK to Contact ID
40 *
41 * @var int unsigned
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 unsigned
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 'table_name' => 'civicrm_website',
97 'entity' => 'Website',
98 'bao' => 'CRM_Core_BAO_Website',
99 'localizable' => 0,
100 ],
101 'contact_id' => [
102 'name' => 'contact_id',
103 'type' => CRM_Utils_Type::T_INT,
104 'title' => ts('Contact'),
105 'description' => ts('FK to Contact ID'),
106 'table_name' => 'civicrm_website',
107 'entity' => 'Website',
108 'bao' => 'CRM_Core_BAO_Website',
109 'localizable' => 0,
110 'FKClassName' => 'CRM_Contact_DAO_Contact',
111 ],
112 'url' => [
113 'name' => 'url',
114 'type' => CRM_Utils_Type::T_STRING,
115 'title' => ts('Website'),
116 'description' => ts('Website'),
117 'maxlength' => 128,
118 'size' => 30,
119 'import' => TRUE,
120 'where' => 'civicrm_website.url',
121 'headerPattern' => '/Website/i',
122 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/',
123 'export' => TRUE,
124 'table_name' => 'civicrm_website',
125 'entity' => 'Website',
126 'bao' => 'CRM_Core_BAO_Website',
127 'localizable' => 0,
128 'html' => [
129 'type' => 'Text',
130 ],
131 ],
132 'website_type_id' => [
133 'name' => 'website_type_id',
134 'type' => CRM_Utils_Type::T_INT,
135 'title' => ts('Website Type'),
136 'description' => ts('Which Website type does this website belong to.'),
137 'table_name' => 'civicrm_website',
138 'entity' => 'Website',
139 'bao' => 'CRM_Core_BAO_Website',
140 'localizable' => 0,
141 'html' => [
142 'type' => 'Select',
143 ],
144 'pseudoconstant' => [
145 'optionGroupName' => 'website_type',
146 'optionEditPath' => 'civicrm/admin/options/website_type',
147 ]
148 ],
149 ];
150 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
151 }
152 return Civi::$statics[__CLASS__]['fields'];
153 }
154
155 /**
156 * Return a mapping from field-name to the corresponding key (as used in fields()).
157 *
158 * @return array
159 * Array(string $name => string $uniqueName).
160 */
161 public static function &fieldKeys() {
162 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
163 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
164 }
165 return Civi::$statics[__CLASS__]['fieldKeys'];
166 }
167
168 /**
169 * Returns the names of this table
170 *
171 * @return string
172 */
173 public static function getTableName() {
174 return self::$_tableName;
175 }
176
177 /**
178 * Returns if this table needs to be logged
179 *
180 * @return bool
181 */
182 public function getLog() {
183 return self::$_log;
184 }
185
186 /**
187 * Returns the list of fields that can be imported
188 *
189 * @param bool $prefix
190 *
191 * @return array
192 */
193 public static function &import($prefix = FALSE) {
194 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'website', $prefix, []);
195 return $r;
196 }
197
198 /**
199 * Returns the list of fields that can be exported
200 *
201 * @param bool $prefix
202 *
203 * @return array
204 */
205 public static function &export($prefix = FALSE) {
206 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'website', $prefix, []);
207 return $r;
208 }
209
210 /**
211 * Returns the list of indices
212 *
213 * @param bool $localize
214 *
215 * @return array
216 */
217 public static function indices($localize = TRUE) {
218 $indices = [
219 'UI_website_type_id' => [
220 'name' => 'UI_website_type_id',
221 'field' => [
222 0 => 'website_type_id',
223 ],
224 'localizable' => FALSE,
225 'sig' => 'civicrm_website::0::website_type_id',
226 ],
227 ];
228 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
229 }
230
231 }