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