Merge pull request #18232 from sunilpawar/dev_1942_new
[civicrm-core.git] / CRM / Contact / DAO / ACLContactCache.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/Contact/ACLContactCache.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
929a1c14 9 * (GenCodeChecksum:97d9be5e13ece64b6c9ad1722d9bca68)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the ACLContactCache entity.
f41f0342 14 */
e501603b 15class CRM_Contact_DAO_ACLContactCache extends CRM_Core_DAO {
929a1c14
CW
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '3.1';
c3fc2621 18
e501603b 19 /**
f41f0342 20 * Static instance to hold the table name.
e501603b
TO
21 *
22 * @var string
23 */
fa45b5b9 24 public static $_tableName = 'civicrm_acl_contact_cache';
c3fc2621 25
e501603b 26 /**
f41f0342 27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 28 *
c3fc2621 29 * @var bool
e501603b 30 */
fa45b5b9 31 public static $_log = FALSE;
c3fc2621 32
e501603b
TO
33 /**
34 * primary key
35 *
e6ca0a57 36 * @var int
e501603b
TO
37 */
38 public $id;
c3fc2621 39
e501603b
TO
40 /**
41 * FK to civicrm_contact (could be null for anon user)
42 *
e6ca0a57 43 * @var int
e501603b
TO
44 */
45 public $user_id;
c3fc2621 46
e501603b
TO
47 /**
48 * FK to civicrm_contact
49 *
e6ca0a57 50 * @var int
e501603b
TO
51 */
52 public $contact_id;
c3fc2621 53
e501603b
TO
54 /**
55 * What operation does this user have permission on?
56 *
57 * @var string
58 */
59 public $operation;
c3fc2621 60
e501603b 61 /**
f41f0342 62 * Class constructor.
e501603b 63 */
c3fc2621 64 public function __construct() {
e501603b
TO
65 $this->__table = 'civicrm_acl_contact_cache';
66 parent::__construct();
67 }
c3fc2621 68
449c4e6b
CW
69 /**
70 * Returns localized title of this entity.
71 */
72 public static function getEntityTitle() {
73 return ts('ACLContact Caches');
74 }
75
e501603b 76 /**
f41f0342 77 * Returns foreign keys and entity references.
e501603b
TO
78 *
79 * @return array
80 * [CRM_Core_Reference_Interface]
81 */
c3fc2621 82 public static function getReferenceColumns() {
346aaaba 83 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 84 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621 85 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
346aaaba 86 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 87 }
346aaaba 88 return Civi::$statics[__CLASS__]['links'];
e501603b 89 }
c3fc2621 90
e501603b
TO
91 /**
92 * Returns all the column names of this table
93 *
94 * @return array
95 */
c3fc2621 96 public static function &fields() {
346aaaba 97 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
98 Civi::$statics[__CLASS__]['fields'] = [
99 'id' => [
e501603b
TO
100 'name' => 'id',
101 'type' => CRM_Utils_Type::T_INT,
c3fc2621 102 'title' => ts('ACL Contact Cache ID'),
215b423e 103 'description' => ts('primary key'),
c3fc2621 104 'required' => TRUE,
a36434b9 105 'where' => 'civicrm_acl_contact_cache.id',
522a26c9 106 'table_name' => 'civicrm_acl_contact_cache',
107 'entity' => 'ACLContactCache',
108 'bao' => 'CRM_Contact_DAO_ACLContactCache',
6a7e5e5d 109 'localizable' => 0,
a9d0587b 110 'add' => '3.1',
c3fc2621
CW
111 ],
112 'user_id' => [
e501603b
TO
113 'name' => 'user_id',
114 'type' => CRM_Utils_Type::T_INT,
c3fc2621 115 'title' => ts('Contact ID'),
215b423e 116 'description' => ts('FK to civicrm_contact (could be null for anon user)'),
a36434b9 117 'where' => 'civicrm_acl_contact_cache.user_id',
522a26c9 118 'table_name' => 'civicrm_acl_contact_cache',
119 'entity' => 'ACLContactCache',
120 'bao' => 'CRM_Contact_DAO_ACLContactCache',
6a7e5e5d 121 'localizable' => 0,
a9d0587b 122 'add' => '3.1',
c3fc2621
CW
123 ],
124 'contact_id' => [
e501603b
TO
125 'name' => 'contact_id',
126 'type' => CRM_Utils_Type::T_INT,
c3fc2621 127 'title' => ts('Contact ID'),
215b423e 128 'description' => ts('FK to civicrm_contact'),
c3fc2621 129 'required' => TRUE,
a36434b9 130 'where' => 'civicrm_acl_contact_cache.contact_id',
522a26c9 131 'table_name' => 'civicrm_acl_contact_cache',
132 'entity' => 'ACLContactCache',
133 'bao' => 'CRM_Contact_DAO_ACLContactCache',
6a7e5e5d 134 'localizable' => 0,
e501603b 135 'FKClassName' => 'CRM_Contact_DAO_Contact',
a9d0587b 136 'add' => '3.1',
c3fc2621
CW
137 ],
138 'operation' => [
e501603b
TO
139 'name' => 'operation',
140 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 141 'title' => ts('Operation'),
215b423e 142 'description' => ts('What operation does this user have permission on?'),
c3fc2621 143 'required' => TRUE,
e501603b
TO
144 'maxlength' => 8,
145 'size' => CRM_Utils_Type::EIGHT,
a36434b9 146 'where' => 'civicrm_acl_contact_cache.operation',
522a26c9 147 'table_name' => 'civicrm_acl_contact_cache',
148 'entity' => 'ACLContactCache',
149 'bao' => 'CRM_Contact_DAO_ACLContactCache',
6a7e5e5d 150 'localizable' => 0,
c3fc2621 151 'html' => [
e501603b 152 'type' => 'Select',
c3fc2621
CW
153 ],
154 'pseudoconstant' => [
e501603b 155 'callback' => 'CRM_ACL_BAO_ACL::operation',
e6ca0a57 156 ],
a9d0587b 157 'add' => '1.6',
c3fc2621
CW
158 ],
159 ];
346aaaba 160 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 161 }
346aaaba 162 return Civi::$statics[__CLASS__]['fields'];
e501603b 163 }
c3fc2621 164
e501603b 165 /**
bd8e0b14 166 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
167 *
168 * @return array
bd8e0b14 169 * Array(string $name => string $uniqueName).
e501603b 170 */
c3fc2621 171 public static function &fieldKeys() {
bd8e0b14
TO
172 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
173 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 174 }
bd8e0b14 175 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 176 }
c3fc2621 177
e501603b
TO
178 /**
179 * Returns the names of this table
180 *
181 * @return string
182 */
c3fc2621 183 public static function getTableName() {
e501603b
TO
184 return self::$_tableName;
185 }
c3fc2621 186
e501603b
TO
187 /**
188 * Returns if this table needs to be logged
189 *
c3fc2621 190 * @return bool
e501603b 191 */
c3fc2621 192 public function getLog() {
e501603b
TO
193 return self::$_log;
194 }
c3fc2621 195
e501603b
TO
196 /**
197 * Returns the list of fields that can be imported
198 *
199 * @param bool $prefix
200 *
201 * @return array
202 */
c3fc2621
CW
203 public static function &import($prefix = FALSE) {
204 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'acl_contact_cache', $prefix, []);
60808919 205 return $r;
e501603b 206 }
c3fc2621 207
e501603b
TO
208 /**
209 * Returns the list of fields that can be exported
210 *
211 * @param bool $prefix
212 *
213 * @return array
214 */
c3fc2621
CW
215 public static function &export($prefix = FALSE) {
216 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'acl_contact_cache', $prefix, []);
60808919 217 return $r;
e501603b 218 }
c3fc2621 219
e7a6b91a
AS
220 /**
221 * Returns the list of indices
c3fc2621
CW
222 *
223 * @param bool $localize
224 *
225 * @return array
e7a6b91a
AS
226 */
227 public static function indices($localize = TRUE) {
c3fc2621
CW
228 $indices = [
229 'UI_user_contact_operation' => [
e7a6b91a 230 'name' => 'UI_user_contact_operation',
c3fc2621 231 'field' => [
e7a6b91a
AS
232 0 => 'user_id',
233 1 => 'contact_id',
234 2 => 'operation',
c3fc2621
CW
235 ],
236 'localizable' => FALSE,
237 'unique' => TRUE,
e7a6b91a 238 'sig' => 'civicrm_acl_contact_cache::1::user_id::contact_id::operation',
c3fc2621
CW
239 ],
240 ];
e7a6b91a
AS
241 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
242 }
c3fc2621 243
e501603b 244}