Merge pull request #13229 from civicrm/5.8
[civicrm-core.git] / CRM / Contact / DAO / ACLContactCache.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2018
6 *
7 * Generated from xml/schema/CRM/Contact/ACLContactCache.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:4bb9eaae5704bfc98c258aa2f2130f5c)
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 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 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(), 'user_id', 'civicrm_contact', 'id');
77 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
78 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
79 }
80 return Civi::$statics[__CLASS__]['links'];
81 }
82
83 /**
84 * Returns all the column names of this table
85 *
86 * @return array
87 */
88 public static function &fields() {
89 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
90 Civi::$statics[__CLASS__]['fields'] = [
91 'id' => [
92 'name' => 'id',
93 'type' => CRM_Utils_Type::T_INT,
94 'title' => ts('ACL Contact Cache ID'),
95 'description' => ts('primary key'),
96 'required' => TRUE,
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 'table_name' => 'civicrm_acl_contact_cache',
108 'entity' => 'ACLContactCache',
109 'bao' => 'CRM_Contact_DAO_ACLContactCache',
110 'localizable' => 0,
111 'FKClassName' => 'CRM_Contact_DAO_Contact',
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 'table_name' => 'civicrm_acl_contact_cache',
120 'entity' => 'ACLContactCache',
121 'bao' => 'CRM_Contact_DAO_ACLContactCache',
122 'localizable' => 0,
123 'FKClassName' => 'CRM_Contact_DAO_Contact',
124 ],
125 'operation' => [
126 'name' => 'operation',
127 'type' => CRM_Utils_Type::T_STRING,
128 'title' => ts('Operation'),
129 'description' => ts('What operation does this user have permission on?'),
130 'required' => TRUE,
131 'maxlength' => 8,
132 'size' => CRM_Utils_Type::EIGHT,
133 'table_name' => 'civicrm_acl_contact_cache',
134 'entity' => 'ACLContactCache',
135 'bao' => 'CRM_Contact_DAO_ACLContactCache',
136 'localizable' => 0,
137 'html' => [
138 'type' => 'Select',
139 ],
140 'pseudoconstant' => [
141 'callback' => 'CRM_ACL_BAO_ACL::operation',
142 ]
143 ],
144 ];
145 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
146 }
147 return Civi::$statics[__CLASS__]['fields'];
148 }
149
150 /**
151 * Return a mapping from field-name to the corresponding key (as used in fields()).
152 *
153 * @return array
154 * Array(string $name => string $uniqueName).
155 */
156 public static function &fieldKeys() {
157 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
158 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
159 }
160 return Civi::$statics[__CLASS__]['fieldKeys'];
161 }
162
163 /**
164 * Returns the names of this table
165 *
166 * @return string
167 */
168 public static function getTableName() {
169 return self::$_tableName;
170 }
171
172 /**
173 * Returns if this table needs to be logged
174 *
175 * @return bool
176 */
177 public function getLog() {
178 return self::$_log;
179 }
180
181 /**
182 * Returns the list of fields that can be imported
183 *
184 * @param bool $prefix
185 *
186 * @return array
187 */
188 public static function &import($prefix = FALSE) {
189 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'acl_contact_cache', $prefix, []);
190 return $r;
191 }
192
193 /**
194 * Returns the list of fields that can be exported
195 *
196 * @param bool $prefix
197 *
198 * @return array
199 */
200 public static function &export($prefix = FALSE) {
201 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'acl_contact_cache', $prefix, []);
202 return $r;
203 }
204
205 /**
206 * Returns the list of indices
207 *
208 * @param bool $localize
209 *
210 * @return array
211 */
212 public static function indices($localize = TRUE) {
213 $indices = [
214 'UI_user_contact_operation' => [
215 'name' => 'UI_user_contact_operation',
216 'field' => [
217 0 => 'user_id',
218 1 => 'contact_id',
219 2 => 'operation',
220 ],
221 'localizable' => FALSE,
222 'unique' => TRUE,
223 'sig' => 'civicrm_acl_contact_cache::1::user_id::contact_id::operation',
224 ],
225 ];
226 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
227 }
228
229 }