Merge pull request #20690 from civicrm/5.39
[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:6547ff2f60e61de44f3ca5a866c1df6a)
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 'html' => [
128 'type' => 'Number',
129 ],
130 'readonly' => TRUE,
131 'add' => '2.0',
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_openid.contact_id',
139 'table_name' => 'civicrm_openid',
140 'entity' => 'OpenID',
141 'bao' => 'CRM_Core_BAO_OpenID',
142 'localizable' => 0,
143 'FKClassName' => 'CRM_Contact_DAO_Contact',
144 'html' => [
145 'label' => ts("Contact"),
146 ],
147 'add' => '2.0',
148 ],
149 'location_type_id' => [
150 'name' => 'location_type_id',
151 'type' => CRM_Utils_Type::T_INT,
152 'title' => ts('OpenID Location Type'),
153 'description' => ts('Which Location does this email belong to.'),
154 'where' => 'civicrm_openid.location_type_id',
155 'table_name' => 'civicrm_openid',
156 'entity' => 'OpenID',
157 'bao' => 'CRM_Core_BAO_OpenID',
158 'localizable' => 0,
159 'pseudoconstant' => [
160 'table' => 'civicrm_location_type',
161 'keyColumn' => 'id',
162 'labelColumn' => 'display_name',
163 ],
164 'add' => '2.0',
165 ],
166 'openid' => [
167 'name' => 'openid',
168 'type' => CRM_Utils_Type::T_STRING,
169 'title' => ts('OpenID'),
170 'description' => ts('the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM'),
171 'maxlength' => 255,
172 'size' => CRM_Utils_Type::HUGE,
173 'import' => TRUE,
174 'where' => 'civicrm_openid.openid',
175 'headerPattern' => '/^Open.?ID|u(niq\w*)?.?ID/i',
176 'dataPattern' => '/^[\w\/\:\.]+$/',
177 'export' => TRUE,
178 'rule' => 'url',
179 'table_name' => 'civicrm_openid',
180 'entity' => 'OpenID',
181 'bao' => 'CRM_Core_BAO_OpenID',
182 'localizable' => 0,
183 'add' => '2.0',
184 ],
185 'allowed_to_login' => [
186 'name' => 'allowed_to_login',
187 'type' => CRM_Utils_Type::T_BOOLEAN,
188 'title' => ts('Allowed to login?'),
189 'description' => ts('Whether or not this user is allowed to login'),
190 'required' => TRUE,
191 'where' => 'civicrm_openid.allowed_to_login',
192 'default' => '0',
193 'table_name' => 'civicrm_openid',
194 'entity' => 'OpenID',
195 'bao' => 'CRM_Core_BAO_OpenID',
196 'localizable' => 0,
197 'add' => '2.0',
198 ],
199 'is_primary' => [
200 'name' => 'is_primary',
201 'type' => CRM_Utils_Type::T_BOOLEAN,
202 'title' => ts('Primary ID'),
203 'description' => ts('Is this the primary email for this contact and location.'),
204 'where' => 'civicrm_openid.is_primary',
205 'default' => '0',
206 'table_name' => 'civicrm_openid',
207 'entity' => 'OpenID',
208 'bao' => 'CRM_Core_BAO_OpenID',
209 'localizable' => 0,
210 'html' => [
211 'type' => 'Radio',
212 ],
213 'add' => '2.0',
214 ],
215 ];
216 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
217 }
218 return Civi::$statics[__CLASS__]['fields'];
219 }
220
221 /**
222 * Return a mapping from field-name to the corresponding key (as used in fields()).
223 *
224 * @return array
225 * Array(string $name => string $uniqueName).
226 */
227 public static function &fieldKeys() {
228 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
229 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
230 }
231 return Civi::$statics[__CLASS__]['fieldKeys'];
232 }
233
234 /**
235 * Returns the names of this table
236 *
237 * @return string
238 */
239 public static function getTableName() {
240 return self::$_tableName;
241 }
242
243 /**
244 * Returns if this table needs to be logged
245 *
246 * @return bool
247 */
248 public function getLog() {
249 return self::$_log;
250 }
251
252 /**
253 * Returns the list of fields that can be imported
254 *
255 * @param bool $prefix
256 *
257 * @return array
258 */
259 public static function &import($prefix = FALSE) {
260 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'openid', $prefix, []);
261 return $r;
262 }
263
264 /**
265 * Returns the list of fields that can be exported
266 *
267 * @param bool $prefix
268 *
269 * @return array
270 */
271 public static function &export($prefix = FALSE) {
272 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'openid', $prefix, []);
273 return $r;
274 }
275
276 /**
277 * Returns the list of indices
278 *
279 * @param bool $localize
280 *
281 * @return array
282 */
283 public static function indices($localize = TRUE) {
284 $indices = [
285 'index_location_type' => [
286 'name' => 'index_location_type',
287 'field' => [
288 0 => 'location_type_id',
289 ],
290 'localizable' => FALSE,
291 'sig' => 'civicrm_openid::0::location_type_id',
292 ],
293 'UI_openid' => [
294 'name' => 'UI_openid',
295 'field' => [
296 0 => 'openid',
297 ],
298 'localizable' => FALSE,
299 'unique' => TRUE,
300 'sig' => 'civicrm_openid::1::openid',
301 ],
302 ];
303 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
304 }
305
306 }