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