Merge pull request #17512 from semseysandor/relative-date-filter
[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:4fcc767aa82b542cd813a9de097a322c)
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
35 */
36 public $id;
37
38 /**
39 * FK to Contact ID
40 *
41 * @var int
42 */
43 public $contact_id;
44
45 /**
46 * Which Location does this email belong to.
47 *
48 * @var int
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 bool
63 */
64 public $allowed_to_login;
65
66 /**
67 * Is this the primary email for this contact and location.
68 *
69 * @var bool
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 localized title of this entity.
83 */
84 public static function getEntityTitle() {
85 return ts('Open IDs');
86 }
87
88 /**
89 * Returns foreign keys and entity references.
90 *
91 * @return array
92 * [CRM_Core_Reference_Interface]
93 */
94 public static function getReferenceColumns() {
95 if (!isset(Civi::$statics[__CLASS__]['links'])) {
96 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
97 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
98 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
99 }
100 return Civi::$statics[__CLASS__]['links'];
101 }
102
103 /**
104 * Returns all the column names of this table
105 *
106 * @return array
107 */
108 public static function &fields() {
109 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
110 Civi::$statics[__CLASS__]['fields'] = [
111 'id' => [
112 'name' => 'id',
113 'type' => CRM_Utils_Type::T_INT,
114 'title' => ts('Open ID identifier'),
115 'description' => ts('Unique OpenID ID'),
116 'required' => TRUE,
117 'where' => 'civicrm_openid.id',
118 'table_name' => 'civicrm_openid',
119 'entity' => 'OpenID',
120 'bao' => 'CRM_Core_BAO_OpenID',
121 'localizable' => 0,
122 ],
123 'contact_id' => [
124 'name' => 'contact_id',
125 'type' => CRM_Utils_Type::T_INT,
126 'title' => ts('OpenID Contact'),
127 'description' => ts('FK to Contact ID'),
128 'where' => 'civicrm_openid.contact_id',
129 'table_name' => 'civicrm_openid',
130 'entity' => 'OpenID',
131 'bao' => 'CRM_Core_BAO_OpenID',
132 'localizable' => 0,
133 'FKClassName' => 'CRM_Contact_DAO_Contact',
134 ],
135 'location_type_id' => [
136 'name' => 'location_type_id',
137 'type' => CRM_Utils_Type::T_INT,
138 'title' => ts('OpenID Location Type'),
139 'description' => ts('Which Location does this email belong to.'),
140 'where' => 'civicrm_openid.location_type_id',
141 'table_name' => 'civicrm_openid',
142 'entity' => 'OpenID',
143 'bao' => 'CRM_Core_BAO_OpenID',
144 'localizable' => 0,
145 'pseudoconstant' => [
146 'table' => 'civicrm_location_type',
147 'keyColumn' => 'id',
148 'labelColumn' => 'display_name',
149 ],
150 ],
151 'openid' => [
152 'name' => 'openid',
153 'type' => CRM_Utils_Type::T_STRING,
154 'title' => ts('OpenID'),
155 'description' => ts('the OpenID (or OpenID-style http://username.domain/) unique identifier for this contact mainly used for logging in to CiviCRM'),
156 'maxlength' => 255,
157 'size' => CRM_Utils_Type::HUGE,
158 'import' => TRUE,
159 'where' => 'civicrm_openid.openid',
160 'headerPattern' => '/^Open.?ID|u(niq\w*)?.?ID/i',
161 'dataPattern' => '/^[\w\/\:\.]+$/',
162 'export' => TRUE,
163 'rule' => 'url',
164 'table_name' => 'civicrm_openid',
165 'entity' => 'OpenID',
166 'bao' => 'CRM_Core_BAO_OpenID',
167 'localizable' => 0,
168 ],
169 'allowed_to_login' => [
170 'name' => 'allowed_to_login',
171 'type' => CRM_Utils_Type::T_BOOLEAN,
172 'title' => ts('Allowed to login?'),
173 'description' => ts('Whether or not this user is allowed to login'),
174 'required' => TRUE,
175 'where' => 'civicrm_openid.allowed_to_login',
176 'default' => '0',
177 'table_name' => 'civicrm_openid',
178 'entity' => 'OpenID',
179 'bao' => 'CRM_Core_BAO_OpenID',
180 'localizable' => 0,
181 ],
182 'is_primary' => [
183 'name' => 'is_primary',
184 'type' => CRM_Utils_Type::T_BOOLEAN,
185 'title' => ts('Primary ID'),
186 'description' => ts('Is this the primary email for this contact and location.'),
187 'where' => 'civicrm_openid.is_primary',
188 'default' => '0',
189 'table_name' => 'civicrm_openid',
190 'entity' => 'OpenID',
191 'bao' => 'CRM_Core_BAO_OpenID',
192 'localizable' => 0,
193 'html' => [
194 'type' => 'Radio',
195 ],
196 ],
197 ];
198 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
199 }
200 return Civi::$statics[__CLASS__]['fields'];
201 }
202
203 /**
204 * Return a mapping from field-name to the corresponding key (as used in fields()).
205 *
206 * @return array
207 * Array(string $name => string $uniqueName).
208 */
209 public static function &fieldKeys() {
210 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
211 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
212 }
213 return Civi::$statics[__CLASS__]['fieldKeys'];
214 }
215
216 /**
217 * Returns the names of this table
218 *
219 * @return string
220 */
221 public static function getTableName() {
222 return self::$_tableName;
223 }
224
225 /**
226 * Returns if this table needs to be logged
227 *
228 * @return bool
229 */
230 public function getLog() {
231 return self::$_log;
232 }
233
234 /**
235 * Returns the list of fields that can be imported
236 *
237 * @param bool $prefix
238 *
239 * @return array
240 */
241 public static function &import($prefix = FALSE) {
242 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'openid', $prefix, []);
243 return $r;
244 }
245
246 /**
247 * Returns the list of fields that can be exported
248 *
249 * @param bool $prefix
250 *
251 * @return array
252 */
253 public static function &export($prefix = FALSE) {
254 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'openid', $prefix, []);
255 return $r;
256 }
257
258 /**
259 * Returns the list of indices
260 *
261 * @param bool $localize
262 *
263 * @return array
264 */
265 public static function indices($localize = TRUE) {
266 $indices = [
267 'index_location_type' => [
268 'name' => 'index_location_type',
269 'field' => [
270 0 => 'location_type_id',
271 ],
272 'localizable' => FALSE,
273 'sig' => 'civicrm_openid::0::location_type_id',
274 ],
275 'UI_openid' => [
276 'name' => 'UI_openid',
277 'field' => [
278 0 => 'openid',
279 ],
280 'localizable' => FALSE,
281 'unique' => TRUE,
282 'sig' => 'civicrm_openid::1::openid',
283 ],
284 ];
285 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
286 }
287
288 }