Merge pull request #13970 from eileenmcnaughton/array_format_3
[civicrm-core.git] / CRM / ACL / DAO / Cache.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/ACL/Cache.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:7551610e08f73f20ef3e5b9ef6782f80)
10 */
11
12 /**
13 * Database access object for the Cache entity.
14 */
15 class CRM_ACL_DAO_Cache extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 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 static $_log = FALSE;
30
31 /**
32 * Unique table ID
33 *
34 * @var int unsigned
35 */
36 public $id;
37
38 /**
39 * Foreign Key to Contact
40 *
41 * @var int unsigned
42 */
43 public $contact_id;
44
45 /**
46 * Foreign Key to ACL
47 *
48 * @var int unsigned
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 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 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'acl_id', 'civicrm_acl', '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('Cache ID'),
95 'description' => ts('Unique table ID'),
96 'required' => TRUE,
97 'table_name' => 'civicrm_acl_cache',
98 'entity' => 'Cache',
99 'bao' => 'CRM_ACL_BAO_Cache',
100 'localizable' => 0,
101 ],
102 'contact_id' => [
103 'name' => 'contact_id',
104 'type' => CRM_Utils_Type::T_INT,
105 'title' => ts('Cache Contact'),
106 'description' => ts('Foreign Key to Contact'),
107 'table_name' => 'civicrm_acl_cache',
108 'entity' => 'Cache',
109 'bao' => 'CRM_ACL_BAO_Cache',
110 'localizable' => 0,
111 'FKClassName' => 'CRM_Contact_DAO_Contact',
112 ],
113 'acl_id' => [
114 'name' => 'acl_id',
115 'type' => CRM_Utils_Type::T_INT,
116 'title' => ts('Cache ACL'),
117 'description' => ts('Foreign Key to ACL'),
118 'required' => TRUE,
119 'table_name' => 'civicrm_acl_cache',
120 'entity' => 'Cache',
121 'bao' => 'CRM_ACL_BAO_Cache',
122 'localizable' => 0,
123 'FKClassName' => 'CRM_ACL_DAO_ACL',
124 ],
125 'modified_date' => [
126 'name' => 'modified_date',
127 'type' => CRM_Utils_Type::T_TIMESTAMP,
128 'title' => ts('Cache Modified Date'),
129 'description' => ts('When was this cache entry last modified'),
130 'required' => FALSE,
131 'table_name' => 'civicrm_acl_cache',
132 'entity' => 'Cache',
133 'bao' => 'CRM_ACL_BAO_Cache',
134 'localizable' => 0,
135 ],
136 ];
137 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
138 }
139 return Civi::$statics[__CLASS__]['fields'];
140 }
141
142 /**
143 * Return a mapping from field-name to the corresponding key (as used in fields()).
144 *
145 * @return array
146 * Array(string $name => string $uniqueName).
147 */
148 public static function &fieldKeys() {
149 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
150 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
151 }
152 return Civi::$statics[__CLASS__]['fieldKeys'];
153 }
154
155 /**
156 * Returns the names of this table
157 *
158 * @return string
159 */
160 public static function getTableName() {
161 return self::$_tableName;
162 }
163
164 /**
165 * Returns if this table needs to be logged
166 *
167 * @return bool
168 */
169 public function getLog() {
170 return self::$_log;
171 }
172
173 /**
174 * Returns the list of fields that can be imported
175 *
176 * @param bool $prefix
177 *
178 * @return array
179 */
180 public static function &import($prefix = FALSE) {
181 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'acl_cache', $prefix, []);
182 return $r;
183 }
184
185 /**
186 * Returns the list of fields that can be exported
187 *
188 * @param bool $prefix
189 *
190 * @return array
191 */
192 public static function &export($prefix = FALSE) {
193 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'acl_cache', $prefix, []);
194 return $r;
195 }
196
197 /**
198 * Returns the list of indices
199 *
200 * @param bool $localize
201 *
202 * @return array
203 */
204 public static function indices($localize = TRUE) {
205 $indices = [
206 'index_acl_id' => [
207 'name' => 'index_acl_id',
208 'field' => [
209 0 => 'acl_id',
210 ],
211 'localizable' => FALSE,
212 'sig' => 'civicrm_acl_cache::0::acl_id',
213 ],
214 ];
215 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
216 }
217
218 }