Merge pull request #18493 from mlutfy/campaignReportDefaults
[civicrm-core.git] / CRM / Contact / DAO / ACLContactCache.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Contact/ACLContactCache.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:4eaf1e99ce247c430fc280cc6ce68538)
10 */
11
12 /**
13 * Database access object for the ACLContactCache entity.
14 */
15 class CRM_Contact_DAO_ACLContactCache extends CRM_Core_DAO {
16 const EXT = 'civicrm';
17 const TABLE_ADDED = '3.1';
18
19 /**
20 * Static instance to hold the table name.
21 *
22 * @var string
23 */
24 public static $_tableName = 'civicrm_acl_contact_cache';
25
26 /**
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
28 *
29 * @var bool
30 */
31 public static $_log = FALSE;
32
33 /**
34 * primary key
35 *
36 * @var int
37 */
38 public $id;
39
40 /**
41 * FK to civicrm_contact (could be null for anon user)
42 *
43 * @var int
44 */
45 public $user_id;
46
47 /**
48 * FK to civicrm_contact
49 *
50 * @var int
51 */
52 public $contact_id;
53
54 /**
55 * What operation does this user have permission on?
56 *
57 * @var string
58 */
59 public $operation;
60
61 /**
62 * Class constructor.
63 */
64 public function __construct() {
65 $this->__table = 'civicrm_acl_contact_cache';
66 parent::__construct();
67 }
68
69 /**
70 * Returns localized title of this entity.
71 *
72 * @param bool $plural
73 * Whether to return the plural version of the title.
74 */
75 public static function getEntityTitle($plural = FALSE) {
76 return $plural ? ts('ACLContact Caches') : ts('ACLContact Cache');
77 }
78
79 /**
80 * Returns all the column names of this table
81 *
82 * @return array
83 */
84 public static function &fields() {
85 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
86 Civi::$statics[__CLASS__]['fields'] = [
87 'id' => [
88 'name' => 'id',
89 'type' => CRM_Utils_Type::T_INT,
90 'title' => ts('ACL Contact Cache ID'),
91 'description' => ts('primary key'),
92 'required' => TRUE,
93 'where' => 'civicrm_acl_contact_cache.id',
94 'table_name' => 'civicrm_acl_contact_cache',
95 'entity' => 'ACLContactCache',
96 'bao' => 'CRM_Contact_DAO_ACLContactCache',
97 'localizable' => 0,
98 'add' => '3.1',
99 ],
100 'user_id' => [
101 'name' => 'user_id',
102 'type' => CRM_Utils_Type::T_INT,
103 'title' => ts('Contact ID'),
104 'description' => ts('FK to civicrm_contact (could be null for anon user)'),
105 'where' => 'civicrm_acl_contact_cache.user_id',
106 'table_name' => 'civicrm_acl_contact_cache',
107 'entity' => 'ACLContactCache',
108 'bao' => 'CRM_Contact_DAO_ACLContactCache',
109 'localizable' => 0,
110 'add' => '3.1',
111 ],
112 'contact_id' => [
113 'name' => 'contact_id',
114 'type' => CRM_Utils_Type::T_INT,
115 'title' => ts('Contact ID'),
116 'description' => ts('FK to civicrm_contact'),
117 'required' => TRUE,
118 'where' => 'civicrm_acl_contact_cache.contact_id',
119 'table_name' => 'civicrm_acl_contact_cache',
120 'entity' => 'ACLContactCache',
121 'bao' => 'CRM_Contact_DAO_ACLContactCache',
122 'localizable' => 0,
123 'add' => '3.1',
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 'where' => 'civicrm_acl_contact_cache.operation',
134 'table_name' => 'civicrm_acl_contact_cache',
135 'entity' => 'ACLContactCache',
136 'bao' => 'CRM_Contact_DAO_ACLContactCache',
137 'localizable' => 0,
138 'html' => [
139 'type' => 'Select',
140 ],
141 'pseudoconstant' => [
142 'callback' => 'CRM_ACL_BAO_ACL::operation',
143 ],
144 'add' => '1.6',
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 }