fixup CRM-14885 - Import DAOs
[civicrm-core.git] / CRM / Core / DAO / Website.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
6| Copyright CiviCRM LLC (c) 2004-2016 |
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
10| CiviCRM is free software; you can copy, modify, and distribute it |
11| under the terms of the GNU Affero General Public License |
12| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13| |
14| CiviCRM is distributed in the hope that it will be useful, but |
15| WITHOUT ANY WARRANTY; without even the implied warranty of |
16| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17| See the GNU Affero General Public License for more details. |
18| |
19| You should have received a copy of the GNU Affero General Public |
20| License and the CiviCRM Licensing Exception along |
21| with this program; if not, contact CiviCRM LLC |
22| at info[AT]civicrm[DOT]org. If you have questions about the |
23| GNU Affero General Public License or the licensing of CiviCRM, |
24| see the CiviCRM license FAQ at http://civicrm.org/licensing |
25+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
29 * @copyright CiviCRM LLC (c) 2004-2016
30 *
31 * Generated from xml/schema/CRM/Core/Website.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
437fafcf 33 * (GenCodeChecksum:40a585fbb41385458f0332b03388c078)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
37class CRM_Core_DAO_Website extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_website';
44 /**
45 * static instance to hold the field values
46 *
47 * @var array
48 */
49 static $_fields = null;
50 /**
51 * static instance to hold the keys used in $_fields for each field.
52 *
53 * @var array
54 */
55 static $_fieldKeys = null;
56 /**
57 * static instance to hold the FK relationships
58 *
59 * @var string
60 */
61 static $_links = null;
62 /**
63 * static instance to hold the values that can
64 * be imported
65 *
66 * @var array
67 */
68 static $_import = null;
69 /**
70 * static instance to hold the values that can
71 * be exported
72 *
73 * @var array
74 */
75 static $_export = null;
76 /**
77 * static value to see if we should log any modifications to
78 * this table in the civicrm_log table
79 *
80 * @var boolean
81 */
82 static $_log = false;
83 /**
84 * Unique Website ID
85 *
86 * @var int unsigned
87 */
88 public $id;
89 /**
90 * FK to Contact ID
91 *
92 * @var int unsigned
93 */
94 public $contact_id;
95 /**
96 * Website
97 *
98 * @var string
99 */
100 public $url;
101 /**
102 * Which Website type does this website belong to.
103 *
104 * @var int unsigned
105 */
106 public $website_type_id;
107 /**
108 * class constructor
109 *
110 * @return civicrm_website
111 */
112 function __construct() {
113 $this->__table = 'civicrm_website';
114 parent::__construct();
115 }
116 /**
117 * Returns foreign keys and entity references
118 *
119 * @return array
120 * [CRM_Core_Reference_Interface]
121 */
122 static function getReferenceColumns() {
123 if (!self::$_links) {
124 self::$_links = static ::createReferenceColumns(__CLASS__);
125 self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id');
126 }
127 return self::$_links;
128 }
129 /**
130 * Returns all the column names of this table
131 *
132 * @return array
133 */
134 static function &fields() {
135 if (!(self::$_fields)) {
136 self::$_fields = array(
137 'id' => array(
138 'name' => 'id',
139 'type' => CRM_Utils_Type::T_INT,
140 'title' => ts('Website ID') ,
141 'description' => 'Unique Website ID',
142 'required' => true,
143 ) ,
144 'contact_id' => array(
145 'name' => 'contact_id',
146 'type' => CRM_Utils_Type::T_INT,
147 'title' => ts('Contact') ,
148 'description' => 'FK to Contact ID',
149 'FKClassName' => 'CRM_Contact_DAO_Contact',
150 ) ,
151 'url' => array(
152 'name' => 'url',
153 'type' => CRM_Utils_Type::T_STRING,
154 'title' => ts('Website') ,
155 'description' => 'Website',
156 'maxlength' => 128,
157 'size' => 30,
158 'import' => true,
159 'where' => 'civicrm_website.url',
160 'headerPattern' => '/Website/i',
161 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/',
162 'export' => true,
163 'html' => array(
164 'type' => 'Text',
165 ) ,
166 ) ,
167 'website_type_id' => array(
168 'name' => 'website_type_id',
169 'type' => CRM_Utils_Type::T_INT,
170 'title' => ts('Website Type') ,
171 'description' => 'Which Website type does this website belong to.',
172 'html' => array(
173 'type' => 'Select',
174 ) ,
175 'pseudoconstant' => array(
176 'optionGroupName' => 'website_type',
177 'optionEditPath' => 'civicrm/admin/options/website_type',
178 )
179 ) ,
180 );
181 }
182 return self::$_fields;
183 }
184 /**
185 * Returns an array containing, for each field, the arary key used for that
186 * field in self::$_fields.
187 *
188 * @return array
189 */
190 static function &fieldKeys() {
191 if (!(self::$_fieldKeys)) {
192 self::$_fieldKeys = array(
193 'id' => 'id',
194 'contact_id' => 'contact_id',
195 'url' => 'url',
196 'website_type_id' => 'website_type_id',
197 );
198 }
199 return self::$_fieldKeys;
200 }
201 /**
202 * Returns the names of this table
203 *
204 * @return string
205 */
206 static function getTableName() {
207 return self::$_tableName;
208 }
209 /**
210 * Returns if this table needs to be logged
211 *
212 * @return boolean
213 */
214 function getLog() {
215 return self::$_log;
216 }
217 /**
218 * Returns the list of fields that can be imported
219 *
220 * @param bool $prefix
221 *
222 * @return array
223 */
224 static function &import($prefix = false) {
225 if (!(self::$_import)) {
226 self::$_import = array();
227 $fields = self::fields();
228 foreach($fields as $name => $field) {
229 if (CRM_Utils_Array::value('import', $field)) {
230 if ($prefix) {
231 self::$_import['website'] = & $fields[$name];
232 } else {
233 self::$_import[$name] = & $fields[$name];
234 }
235 }
236 }
237 }
238 return self::$_import;
239 }
240 /**
241 * Returns the list of fields that can be exported
242 *
243 * @param bool $prefix
244 *
245 * @return array
246 */
247 static function &export($prefix = false) {
248 if (!(self::$_export)) {
249 self::$_export = array();
250 $fields = self::fields();
251 foreach($fields as $name => $field) {
252 if (CRM_Utils_Array::value('export', $field)) {
253 if ($prefix) {
254 self::$_export['website'] = & $fields[$name];
255 } else {
256 self::$_export[$name] = & $fields[$name];
257 }
258 }
259 }
260 }
261 return self::$_export;
262 }
263}