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