[REF] Remove unused pcp & soft credit handling from previously shared code
[civicrm-core.git] / CRM / Core / DAO / OpenID.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Core/OpenID.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:cb1ead5da887d91854185af42e87d223)
10 */
11
12 /**
13 * Database access object for the OpenID entity.
14 */
15 class CRM_Core_DAO_OpenID extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '2.0';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_openid';
25
26 /**
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
28 *
29 * @var bool
30 */
31 public static $_log = FALSE;
32
33 /**
34 * Unique OpenID ID
35 *
36 * @var int
37 */
38 public $id;
39
40 /**
41 * FK to Contact ID
42 *
43 * @var int
44 */
45 public $contact_id;
46
47 /**
48 * Which Location does this email belong to.
49 *
50 * @var int
51 */
52 public $location_type_id;
53
54 /**
55 * the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM
56 *
57 * @var string
58 */
59 public $openid;
60
61 /**
62 * Whether or not this user is allowed to login
63 *
64 * @var bool
65 */
66 public $allowed_to_login;
67
68 /**
69 * Is this the primary email for this contact and location.
70 *
71 * @var bool
72 */
73 public $is_primary;
74
75 /**
76 * Class constructor.
77 */
78 public function __construct() {
79 $this->__table = 'civicrm_openid';
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('Open IDs') : ts('Open ID');
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('Open ID identifier'),
120 'description' => ts('Unique OpenID ID'),
121 'required' => TRUE,
122 'where' => 'civicrm_openid.id',
123 'table_name' => 'civicrm_openid',
124 'entity' => 'OpenID',
125 'bao' => 'CRM_Core_BAO_OpenID',
126 'localizable' => 0,
127 'add' => '2.0',
128 ],
129 'contact_id' => [
130 'name' => 'contact_id',
131 'type' => CRM_Utils_Type::T_INT,
132 'title' => ts('OpenID Contact'),
133 'description' => ts('FK to Contact ID'),
134 'where' => 'civicrm_openid.contact_id',
135 'table_name' => 'civicrm_openid',
136 'entity' => 'OpenID',
137 'bao' => 'CRM_Core_BAO_OpenID',
138 'localizable' => 0,
139 'FKClassName' => 'CRM_Contact_DAO_Contact',
140 'add' => '2.0',
141 ],
142 'location_type_id' => [
143 'name' => 'location_type_id',
144 'type' => CRM_Utils_Type::T_INT,
145 'title' => ts('OpenID Location Type'),
146 'description' => ts('Which Location does this email belong to.'),
147 'where' => 'civicrm_openid.location_type_id',
148 'table_name' => 'civicrm_openid',
149 'entity' => 'OpenID',
150 'bao' => 'CRM_Core_BAO_OpenID',
151 'localizable' => 0,
152 'pseudoconstant' => [
153 'table' => 'civicrm_location_type',
154 'keyColumn' => 'id',
155 'labelColumn' => 'display_name',
156 ],
157 'add' => '2.0',
158 ],
159 'openid' => [
160 'name' => 'openid',
161 'type' => CRM_Utils_Type::T_STRING,
162 'title' => ts('OpenID'),
163 'description' => ts('the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM'),
164 'maxlength' => 255,
165 'size' => CRM_Utils_Type::HUGE,
166 'import' => TRUE,
167 'where' => 'civicrm_openid.openid',
168 'headerPattern' => '/^Open.?ID|u(niq\w*)?.?ID/i',
169 'dataPattern' => '/^[\w\/\:\.]+$/',
170 'export' => TRUE,
171 'rule' => 'url',
172 'table_name' => 'civicrm_openid',
173 'entity' => 'OpenID',
174 'bao' => 'CRM_Core_BAO_OpenID',
175 'localizable' => 0,
176 'add' => '2.0',
177 ],
178 'allowed_to_login' => [
179 'name' => 'allowed_to_login',
180 'type' => CRM_Utils_Type::T_BOOLEAN,
181 'title' => ts('Allowed to login?'),
182 'description' => ts('Whether or not this user is allowed to login'),
183 'required' => TRUE,
184 'where' => 'civicrm_openid.allowed_to_login',
185 'default' => '0',
186 'table_name' => 'civicrm_openid',
187 'entity' => 'OpenID',
188 'bao' => 'CRM_Core_BAO_OpenID',
189 'localizable' => 0,
190 'add' => '2.0',
191 ],
192 'is_primary' => [
193 'name' => 'is_primary',
194 'type' => CRM_Utils_Type::T_BOOLEAN,
195 'title' => ts('Primary ID'),
196 'description' => ts('Is this the primary email for this contact and location.'),
197 'where' => 'civicrm_openid.is_primary',
198 'default' => '0',
199 'table_name' => 'civicrm_openid',
200 'entity' => 'OpenID',
201 'bao' => 'CRM_Core_BAO_OpenID',
202 'localizable' => 0,
203 'html' => [
204 'type' => 'Radio',
205 ],
206 'add' => '2.0',
207 ],
208 ];
209 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
210 }
211 return Civi::$statics[__CLASS__]['fields'];
212 }
213
214 /**
215 * Return a mapping from field-name to the corresponding key (as used in fields()).
216 *
217 * @return array
218 * Array(string $name => string $uniqueName).
219 */
220 public static function &fieldKeys() {
221 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
222 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
223 }
224 return Civi::$statics[__CLASS__]['fieldKeys'];
225 }
226
227 /**
228 * Returns the names of this table
229 *
230 * @return string
231 */
232 public static function getTableName() {
233 return self::$_tableName;
234 }
235
236 /**
237 * Returns if this table needs to be logged
238 *
239 * @return bool
240 */
241 public function getLog() {
242 return self::$_log;
243 }
244
245 /**
246 * Returns the list of fields that can be imported
247 *
248 * @param bool $prefix
249 *
250 * @return array
251 */
252 public static function &import($prefix = FALSE) {
253 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'openid', $prefix, []);
254 return $r;
255 }
256
257 /**
258 * Returns the list of fields that can be exported
259 *
260 * @param bool $prefix
261 *
262 * @return array
263 */
264 public static function &export($prefix = FALSE) {
265 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'openid', $prefix, []);
266 return $r;
267 }
268
269 /**
270 * Returns the list of indices
271 *
272 * @param bool $localize
273 *
274 * @return array
275 */
276 public static function indices($localize = TRUE) {
277 $indices = [
278 'index_location_type' => [
279 'name' => 'index_location_type',
280 'field' => [
281 0 => 'location_type_id',
282 ],
283 'localizable' => FALSE,
284 'sig' => 'civicrm_openid::0::location_type_id',
285 ],
286 'UI_openid' => [
287 'name' => 'UI_openid',
288 'field' => [
289 0 => 'openid',
290 ],
291 'localizable' => FALSE,
292 'unique' => TRUE,
293 'sig' => 'civicrm_openid::1::openid',
294 ],
295 ];
296 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
297 }
298
299 }