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