Regenerate DAOs with readonly attribute for id fields
[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:5817ea9ead738f208907da1e2729da44)
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
51 */
52 public $id;
53
54 /**
55 * FK to Contact ID
56 *
57 * @var int
58 */
59 public $contact_id;
60
61 /**
62 * Website
63 *
64 * @var string
65 */
66 public $url;
67
68 /**
69 * Which Website type does this website belong to.
70 *
71 * @var int
72 */
73 public $website_type_id;
74
75 /**
76 * Class constructor.
77 */
78 public function __construct() {
79 $this->__table = 'civicrm_website';
80 parent::__construct();
81 }
82
83 /**
84 * Returns localized title of this entity.
85 *
86 * @param bool $plural
87 * Whether to return the plural version of the title.
88 */
89 public static function getEntityTitle($plural = FALSE) {
90 return $plural ? ts('Websites') : ts('Website');
91 }
92
93 /**
94 * Returns foreign keys and entity references.
95 *
96 * @return array
97 * [CRM_Core_Reference_Interface]
98 */
99 public static function getReferenceColumns() {
100 if (!isset(Civi::$statics[__CLASS__]['links'])) {
101 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
102 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
103 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
104 }
105 return Civi::$statics[__CLASS__]['links'];
106 }
107
108 /**
109 * Returns all the column names of this table
110 *
111 * @return array
112 */
113 public static function &fields() {
114 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
115 Civi::$statics[__CLASS__]['fields'] = [
116 'id' => [
117 'name' => 'id',
118 'type' => CRM_Utils_Type::T_INT,
119 'title' => ts('Website ID'),
120 'description' => ts('Unique Website ID'),
121 'required' => TRUE,
122 'where' => 'civicrm_website.id',
123 'table_name' => 'civicrm_website',
124 'entity' => 'Website',
125 'bao' => 'CRM_Core_BAO_Website',
126 'localizable' => 0,
127 'html' => [
128 'type' => 'Number',
129 ],
130 'readonly' => TRUE,
131 'add' => '3.2',
132 ],
133 'contact_id' => [
134 'name' => 'contact_id',
135 'type' => CRM_Utils_Type::T_INT,
136 'title' => ts('Contact ID'),
137 'description' => ts('FK to Contact ID'),
138 'where' => 'civicrm_website.contact_id',
139 'table_name' => 'civicrm_website',
140 'entity' => 'Website',
141 'bao' => 'CRM_Core_BAO_Website',
142 'localizable' => 0,
143 'FKClassName' => 'CRM_Contact_DAO_Contact',
144 'html' => [
145 'label' => ts("Contact"),
146 ],
147 'add' => '3.2',
148 ],
149 'url' => [
150 'name' => 'url',
151 'type' => CRM_Utils_Type::T_STRING,
152 'title' => ts('Website'),
153 'description' => ts('Website'),
154 'maxlength' => 128,
155 'size' => 30,
156 'import' => TRUE,
157 'where' => 'civicrm_website.url',
158 'headerPattern' => '/Website/i',
159 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/',
160 'export' => TRUE,
161 'table_name' => 'civicrm_website',
162 'entity' => 'Website',
163 'bao' => 'CRM_Core_BAO_Website',
164 'localizable' => 0,
165 'html' => [
166 'type' => 'Text',
167 ],
168 'add' => '3.2',
169 ],
170 'website_type_id' => [
171 'name' => 'website_type_id',
172 'type' => CRM_Utils_Type::T_INT,
173 'title' => ts('Website Type'),
174 'description' => ts('Which Website type does this website belong to.'),
175 'where' => 'civicrm_website.website_type_id',
176 'table_name' => 'civicrm_website',
177 'entity' => 'Website',
178 'bao' => 'CRM_Core_BAO_Website',
179 'localizable' => 0,
180 'html' => [
181 'type' => 'Select',
182 ],
183 'pseudoconstant' => [
184 'optionGroupName' => 'website_type',
185 'optionEditPath' => 'civicrm/admin/options/website_type',
186 ],
187 'add' => '3.2',
188 ],
189 ];
190 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
191 }
192 return Civi::$statics[__CLASS__]['fields'];
193 }
194
195 /**
196 * Return a mapping from field-name to the corresponding key (as used in fields()).
197 *
198 * @return array
199 * Array(string $name => string $uniqueName).
200 */
201 public static function &fieldKeys() {
202 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
203 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
204 }
205 return Civi::$statics[__CLASS__]['fieldKeys'];
206 }
207
208 /**
209 * Returns the names of this table
210 *
211 * @return string
212 */
213 public static function getTableName() {
214 return self::$_tableName;
215 }
216
217 /**
218 * Returns if this table needs to be logged
219 *
220 * @return bool
221 */
222 public function getLog() {
223 return self::$_log;
224 }
225
226 /**
227 * Returns the list of fields that can be imported
228 *
229 * @param bool $prefix
230 *
231 * @return array
232 */
233 public static function &import($prefix = FALSE) {
234 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'website', $prefix, []);
235 return $r;
236 }
237
238 /**
239 * Returns the list of fields that can be exported
240 *
241 * @param bool $prefix
242 *
243 * @return array
244 */
245 public static function &export($prefix = FALSE) {
246 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'website', $prefix, []);
247 return $r;
248 }
249
250 /**
251 * Returns the list of indices
252 *
253 * @param bool $localize
254 *
255 * @return array
256 */
257 public static function indices($localize = TRUE) {
258 $indices = [
259 'UI_website_type_id' => [
260 'name' => 'UI_website_type_id',
261 'field' => [
262 0 => 'website_type_id',
263 ],
264 'localizable' => FALSE,
265 'sig' => 'civicrm_website::0::website_type_id',
266 ],
267 ];
268 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
269 }
270
271 }