Merge pull request #17458 from eileenmcnaughton/export
[civicrm-core.git] / CRM / ACL / DAO / ACLCache.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/ACL/ACLCache.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:0427e4f02009f7a66cf34ae18ef397aa)
10 */
11
12 /**
13 * Database access object for the ACLCache entity.
14 */
15 class CRM_ACL_DAO_ACLCache 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_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 * Unique table ID
33 *
34 * @var int
35 */
36 public $id;
37
38 /**
39 * Foreign Key to Contact
40 *
41 * @var int
42 */
43 public $contact_id;
44
45 /**
46 * Foreign Key to ACL
47 *
48 * @var int
49 */
50 public $acl_id;
51
52 /**
53 * When was this cache entry last modified
54 *
55 * @var timestamp
56 */
57 public $modified_date;
58
59 /**
60 * Class constructor.
61 */
62 public function __construct() {
63 $this->__table = 'civicrm_acl_cache';
64 parent::__construct();
65 }
66
67 /**
68 * Returns localized title of this entity.
69 */
70 public static function getEntityTitle() {
71 return ts('ACLCaches');
72 }
73
74 /**
75 * Returns foreign keys and entity references.
76 *
77 * @return array
78 * [CRM_Core_Reference_Interface]
79 */
80 public static function getReferenceColumns() {
81 if (!isset(Civi::$statics[__CLASS__]['links'])) {
82 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
83 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'contact_id', 'civicrm_contact', 'id');
84 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'acl_id', 'civicrm_acl', 'id');
85 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
86 }
87 return Civi::$statics[__CLASS__]['links'];
88 }
89
90 /**
91 * Returns all the column names of this table
92 *
93 * @return array
94 */
95 public static function &fields() {
96 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
97 Civi::$statics[__CLASS__]['fields'] = [
98 'id' => [
99 'name' => 'id',
100 'type' => CRM_Utils_Type::T_INT,
101 'title' => ts('Cache ID'),
102 'description' => ts('Unique table ID'),
103 'required' => TRUE,
104 'where' => 'civicrm_acl_cache.id',
105 'table_name' => 'civicrm_acl_cache',
106 'entity' => 'ACLCache',
107 'bao' => 'CRM_ACL_DAO_ACLCache',
108 'localizable' => 0,
109 'add' => '1.6',
110 ],
111 'contact_id' => [
112 'name' => 'contact_id',
113 'type' => CRM_Utils_Type::T_INT,
114 'title' => ts('Cache Contact'),
115 'description' => ts('Foreign Key to Contact'),
116 'where' => 'civicrm_acl_cache.contact_id',
117 'table_name' => 'civicrm_acl_cache',
118 'entity' => 'ACLCache',
119 'bao' => 'CRM_ACL_DAO_ACLCache',
120 'localizable' => 0,
121 'FKClassName' => 'CRM_Contact_DAO_Contact',
122 'html' => [
123 'type' => 'EntityRef',
124 ],
125 'add' => '1.6',
126 ],
127 'acl_id' => [
128 'name' => 'acl_id',
129 'type' => CRM_Utils_Type::T_INT,
130 'title' => ts('Cache ACL'),
131 'description' => ts('Foreign Key to ACL'),
132 'required' => TRUE,
133 'where' => 'civicrm_acl_cache.acl_id',
134 'table_name' => 'civicrm_acl_cache',
135 'entity' => 'ACLCache',
136 'bao' => 'CRM_ACL_DAO_ACLCache',
137 'localizable' => 0,
138 'FKClassName' => 'CRM_ACL_DAO_ACL',
139 'pseudoconstant' => [
140 'table' => 'civicrm_acl',
141 'keyColumn' => 'id',
142 'labelColumn' => 'name',
143 ],
144 'add' => '1.6',
145 ],
146 'modified_date' => [
147 'name' => 'modified_date',
148 'type' => CRM_Utils_Type::T_TIMESTAMP,
149 'title' => ts('Cache Modified Date'),
150 'description' => ts('When was this cache entry last modified'),
151 'required' => FALSE,
152 'where' => 'civicrm_acl_cache.modified_date',
153 'table_name' => 'civicrm_acl_cache',
154 'entity' => 'ACLCache',
155 'bao' => 'CRM_ACL_DAO_ACLCache',
156 'localizable' => 0,
157 'add' => '1.6',
158 ],
159 ];
160 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
161 }
162 return Civi::$statics[__CLASS__]['fields'];
163 }
164
165 /**
166 * Return a mapping from field-name to the corresponding key (as used in fields()).
167 *
168 * @return array
169 * Array(string $name => string $uniqueName).
170 */
171 public static function &fieldKeys() {
172 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
173 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
174 }
175 return Civi::$statics[__CLASS__]['fieldKeys'];
176 }
177
178 /**
179 * Returns the names of this table
180 *
181 * @return string
182 */
183 public static function getTableName() {
184 return self::$_tableName;
185 }
186
187 /**
188 * Returns if this table needs to be logged
189 *
190 * @return bool
191 */
192 public function getLog() {
193 return self::$_log;
194 }
195
196 /**
197 * Returns the list of fields that can be imported
198 *
199 * @param bool $prefix
200 *
201 * @return array
202 */
203 public static function &import($prefix = FALSE) {
204 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'acl_cache', $prefix, []);
205 return $r;
206 }
207
208 /**
209 * Returns the list of fields that can be exported
210 *
211 * @param bool $prefix
212 *
213 * @return array
214 */
215 public static function &export($prefix = FALSE) {
216 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'acl_cache', $prefix, []);
217 return $r;
218 }
219
220 /**
221 * Returns the list of indices
222 *
223 * @param bool $localize
224 *
225 * @return array
226 */
227 public static function indices($localize = TRUE) {
228 $indices = [
229 'index_acl_id' => [
230 'name' => 'index_acl_id',
231 'field' => [
232 0 => 'acl_id',
233 ],
234 'localizable' => FALSE,
235 'sig' => 'civicrm_acl_cache::0::acl_id',
236 ],
237 'index_modified_date' => [
238 'name' => 'index_modified_date',
239 'field' => [
240 0 => 'modified_date',
241 ],
242 'localizable' => FALSE,
243 'sig' => 'civicrm_acl_cache::0::modified_date',
244 ],
245 ];
246 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
247 }
248
249 }