Merge pull request #14078 from mattwire/mastercard_branding
[civicrm-core.git] / CRM / Core / DAO / OpenID.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Core/OpenID.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:8f43063bba0682c56356dbf7afa64658)
10 */
11
12 /**
13 * Database access object for the OpenID entity.
14 */
15 class CRM_Core_DAO_OpenID extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_openid';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 public static $_log = FALSE;
30
31 /**
32 * Unique OpenID ID
33 *
34 * @var int unsigned
35 */
36 public $id;
37
38 /**
39 * FK to Contact ID
40 *
41 * @var int unsigned
42 */
43 public $contact_id;
44
45 /**
46 * Which Location does this email belong to.
47 *
48 * @var int unsigned
49 */
50 public $location_type_id;
51
52 /**
53 * the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM
54 *
55 * @var string
56 */
57 public $openid;
58
59 /**
60 * Whether or not this user is allowed to login
61 *
62 * @var boolean
63 */
64 public $allowed_to_login;
65
66 /**
67 * Is this the primary email for this contact and location.
68 *
69 * @var boolean
70 */
71 public $is_primary;
72
73 /**
74 * Class constructor.
75 */
76 public function __construct() {
77 $this->__table = 'civicrm_openid';
78 parent::__construct();
79 }
80
81 /**
82 * Returns foreign keys and entity references.
83 *
84 * @return array
85 * [CRM_Core_Reference_Interface]
86 */
87 public static function getReferenceColumns() {
88 if (!isset(Civi::$statics[__CLASS__]['links'])) {
89 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
90 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
91 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
92 }
93 return Civi::$statics[__CLASS__]['links'];
94 }
95
96 /**
97 * Returns all the column names of this table
98 *
99 * @return array
100 */
101 public static function &fields() {
102 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
103 Civi::$statics[__CLASS__]['fields'] = [
104 'id' => [
105 'name' => 'id',
106 'type' => CRM_Utils_Type::T_INT,
107 'title' => ts('Open ID identifier'),
108 'description' => ts('Unique OpenID ID'),
109 'required' => TRUE,
110 'where' => 'civicrm_openid.id',
111 'table_name' => 'civicrm_openid',
112 'entity' => 'OpenID',
113 'bao' => 'CRM_Core_BAO_OpenID',
114 'localizable' => 0,
115 ],
116 'contact_id' => [
117 'name' => 'contact_id',
118 'type' => CRM_Utils_Type::T_INT,
119 'title' => ts('OpenID Contact'),
120 'description' => ts('FK to Contact ID'),
121 'where' => 'civicrm_openid.contact_id',
122 'table_name' => 'civicrm_openid',
123 'entity' => 'OpenID',
124 'bao' => 'CRM_Core_BAO_OpenID',
125 'localizable' => 0,
126 'FKClassName' => 'CRM_Contact_DAO_Contact',
127 ],
128 'location_type_id' => [
129 'name' => 'location_type_id',
130 'type' => CRM_Utils_Type::T_INT,
131 'title' => ts('OpenID Location Type'),
132 'description' => ts('Which Location does this email belong to.'),
133 'where' => 'civicrm_openid.location_type_id',
134 'table_name' => 'civicrm_openid',
135 'entity' => 'OpenID',
136 'bao' => 'CRM_Core_BAO_OpenID',
137 'localizable' => 0,
138 ],
139 'openid' => [
140 'name' => 'openid',
141 'type' => CRM_Utils_Type::T_STRING,
142 'title' => ts('OpenID'),
143 'description' => ts('the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM'),
144 'maxlength' => 255,
145 'size' => CRM_Utils_Type::HUGE,
146 'import' => TRUE,
147 'where' => 'civicrm_openid.openid',
148 'headerPattern' => '/^Open.?ID|u(niq\w*)?.?ID/i',
149 'dataPattern' => '/^[\w\/\:\.]+$/',
150 'export' => TRUE,
151 'rule' => 'url',
152 'table_name' => 'civicrm_openid',
153 'entity' => 'OpenID',
154 'bao' => 'CRM_Core_BAO_OpenID',
155 'localizable' => 0,
156 ],
157 'allowed_to_login' => [
158 'name' => 'allowed_to_login',
159 'type' => CRM_Utils_Type::T_BOOLEAN,
160 'title' => ts('Allowed to login?'),
161 'description' => ts('Whether or not this user is allowed to login'),
162 'required' => TRUE,
163 'where' => 'civicrm_openid.allowed_to_login',
164 'default' => '0',
165 'table_name' => 'civicrm_openid',
166 'entity' => 'OpenID',
167 'bao' => 'CRM_Core_BAO_OpenID',
168 'localizable' => 0,
169 ],
170 'is_primary' => [
171 'name' => 'is_primary',
172 'type' => CRM_Utils_Type::T_BOOLEAN,
173 'title' => ts('Is OpenID Primary?'),
174 'description' => ts('Is this the primary email for this contact and location.'),
175 'where' => 'civicrm_openid.is_primary',
176 'default' => '0',
177 'table_name' => 'civicrm_openid',
178 'entity' => 'OpenID',
179 'bao' => 'CRM_Core_BAO_OpenID',
180 'localizable' => 0,
181 ],
182 ];
183 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
184 }
185 return Civi::$statics[__CLASS__]['fields'];
186 }
187
188 /**
189 * Return a mapping from field-name to the corresponding key (as used in fields()).
190 *
191 * @return array
192 * Array(string $name => string $uniqueName).
193 */
194 public static function &fieldKeys() {
195 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
196 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
197 }
198 return Civi::$statics[__CLASS__]['fieldKeys'];
199 }
200
201 /**
202 * Returns the names of this table
203 *
204 * @return string
205 */
206 public static function getTableName() {
207 return self::$_tableName;
208 }
209
210 /**
211 * Returns if this table needs to be logged
212 *
213 * @return bool
214 */
215 public function getLog() {
216 return self::$_log;
217 }
218
219 /**
220 * Returns the list of fields that can be imported
221 *
222 * @param bool $prefix
223 *
224 * @return array
225 */
226 public static function &import($prefix = FALSE) {
227 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'openid', $prefix, []);
228 return $r;
229 }
230
231 /**
232 * Returns the list of fields that can be exported
233 *
234 * @param bool $prefix
235 *
236 * @return array
237 */
238 public static function &export($prefix = FALSE) {
239 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'openid', $prefix, []);
240 return $r;
241 }
242
243 /**
244 * Returns the list of indices
245 *
246 * @param bool $localize
247 *
248 * @return array
249 */
250 public static function indices($localize = TRUE) {
251 $indices = [
252 'index_location_type' => [
253 'name' => 'index_location_type',
254 'field' => [
255 0 => 'location_type_id',
256 ],
257 'localizable' => FALSE,
258 'sig' => 'civicrm_openid::0::location_type_id',
259 ],
260 'UI_openid' => [
261 'name' => 'UI_openid',
262 'field' => [
263 0 => 'openid',
264 ],
265 'localizable' => FALSE,
266 'unique' => TRUE,
267 'sig' => 'civicrm_openid::1::openid',
268 ],
269 ];
270 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
271 }
272
273 }