Commit | Line | Data |
---|---|---|
58b85361 MD |
1 | <?php |
2 | ||
3 | /** | |
4 | * @package CRM | |
5 | * @copyright CiviCRM LLC https://civicrm.org/licensing | |
6 | * | |
7 | * Generated from xml/schema/CRM/ACL/ACLEntityRole.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
e45b4707 | 9 | * (GenCodeChecksum:b7a657943e1cf6e84d93e4b729fe7d10) |
58b85361 MD |
10 | */ |
11 | ||
12 | /** | |
13 | * Database access object for the ACLEntityRole entity. | |
14 | */ | |
15 | class CRM_ACL_DAO_ACLEntityRole extends CRM_Core_DAO { | |
16 | const EXT = 'civicrm'; | |
17 | const TABLE_ADDED = '1.6'; | |
18 | ||
19 | /** | |
20 | * Static instance to hold the table name. | |
21 | * | |
22 | * @var string | |
23 | */ | |
24 | public static $_tableName = 'civicrm_acl_entity_role'; | |
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 | * Unique table ID | |
35 | * | |
28979d65 CW |
36 | * @var int|string|null |
37 | * (SQL type: int unsigned) | |
38 | * Note that values will be retrieved from the database as a string. | |
58b85361 MD |
39 | */ |
40 | public $id; | |
41 | ||
42 | /** | |
43 | * Foreign Key to ACL Role (which is an option value pair and hence an implicit FK) | |
44 | * | |
28979d65 CW |
45 | * @var int|string |
46 | * (SQL type: int unsigned) | |
47 | * Note that values will be retrieved from the database as a string. | |
58b85361 MD |
48 | */ |
49 | public $acl_role_id; | |
50 | ||
51 | /** | |
52 | * Table of the object joined to the ACL Role (Contact or Group) | |
53 | * | |
54 | * @var string | |
28979d65 CW |
55 | * (SQL type: varchar(64)) |
56 | * Note that values will be retrieved from the database as a string. | |
58b85361 MD |
57 | */ |
58 | public $entity_table; | |
59 | ||
60 | /** | |
61 | * ID of the group/contact object being joined | |
62 | * | |
28979d65 CW |
63 | * @var int|string |
64 | * (SQL type: int unsigned) | |
65 | * Note that values will be retrieved from the database as a string. | |
58b85361 MD |
66 | */ |
67 | public $entity_id; | |
68 | ||
69 | /** | |
70 | * Is this property active? | |
71 | * | |
c1e814c7 | 72 | * @var bool|string |
28979d65 CW |
73 | * (SQL type: tinyint) |
74 | * Note that values will be retrieved from the database as a string. | |
58b85361 MD |
75 | */ |
76 | public $is_active; | |
77 | ||
78 | /** | |
79 | * Class constructor. | |
80 | */ | |
81 | public function __construct() { | |
82 | $this->__table = 'civicrm_acl_entity_role'; | |
83 | parent::__construct(); | |
84 | } | |
85 | ||
86 | /** | |
87 | * Returns localized title of this entity. | |
88 | * | |
89 | * @param bool $plural | |
90 | * Whether to return the plural version of the title. | |
91 | */ | |
92 | public static function getEntityTitle($plural = FALSE) { | |
93 | return $plural ? ts('ACLEntity Roles') : ts('ACLEntity Role'); | |
94 | } | |
95 | ||
96 | /** | |
97 | * Returns foreign keys and entity references. | |
98 | * | |
99 | * @return array | |
100 | * [CRM_Core_Reference_Interface] | |
101 | */ | |
102 | public static function getReferenceColumns() { | |
103 | if (!isset(Civi::$statics[__CLASS__]['links'])) { | |
104 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); | |
105 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); | |
106 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); | |
107 | } | |
108 | return Civi::$statics[__CLASS__]['links']; | |
109 | } | |
110 | ||
111 | /** | |
112 | * Returns all the column names of this table | |
113 | * | |
114 | * @return array | |
115 | */ | |
116 | public static function &fields() { | |
117 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { | |
118 | Civi::$statics[__CLASS__]['fields'] = [ | |
119 | 'id' => [ | |
120 | 'name' => 'id', | |
121 | 'type' => CRM_Utils_Type::T_INT, | |
122 | 'title' => ts('Entity Role'), | |
123 | 'description' => ts('Unique table ID'), | |
124 | 'required' => TRUE, | |
125 | 'where' => 'civicrm_acl_entity_role.id', | |
126 | 'table_name' => 'civicrm_acl_entity_role', | |
127 | 'entity' => 'ACLEntityRole', | |
128 | 'bao' => 'CRM_ACL_BAO_ACLEntityRole', | |
129 | 'localizable' => 0, | |
130 | 'html' => [ | |
131 | 'type' => 'Number', | |
132 | ], | |
133 | 'readonly' => TRUE, | |
134 | 'add' => '1.6', | |
135 | ], | |
136 | 'acl_role_id' => [ | |
137 | 'name' => 'acl_role_id', | |
138 | 'type' => CRM_Utils_Type::T_INT, | |
139 | 'title' => ts('ACL Role ID'), | |
140 | 'description' => ts('Foreign Key to ACL Role (which is an option value pair and hence an implicit FK)'), | |
141 | 'required' => TRUE, | |
142 | 'where' => 'civicrm_acl_entity_role.acl_role_id', | |
143 | 'table_name' => 'civicrm_acl_entity_role', | |
144 | 'entity' => 'ACLEntityRole', | |
145 | 'bao' => 'CRM_ACL_BAO_ACLEntityRole', | |
146 | 'localizable' => 0, | |
2ef3d3b2 EM |
147 | 'pseudoconstant' => [ |
148 | 'optionGroupName' => 'acl_role', | |
149 | 'optionEditPath' => 'civicrm/admin/options/acl_role', | |
150 | ], | |
58b85361 MD |
151 | 'add' => '1.6', |
152 | ], | |
153 | 'entity_table' => [ | |
154 | 'name' => 'entity_table', | |
155 | 'type' => CRM_Utils_Type::T_STRING, | |
156 | 'title' => ts('Entity Table'), | |
157 | 'description' => ts('Table of the object joined to the ACL Role (Contact or Group)'), | |
158 | 'required' => TRUE, | |
159 | 'maxlength' => 64, | |
160 | 'size' => CRM_Utils_Type::BIG, | |
161 | 'where' => 'civicrm_acl_entity_role.entity_table', | |
162 | 'table_name' => 'civicrm_acl_entity_role', | |
163 | 'entity' => 'ACLEntityRole', | |
164 | 'bao' => 'CRM_ACL_BAO_ACLEntityRole', | |
165 | 'localizable' => 0, | |
166 | 'pseudoconstant' => [ | |
167 | 'callback' => 'CRM_ACL_BAO_ACLEntityRole::entityTables', | |
168 | ], | |
169 | 'add' => '1.6', | |
170 | ], | |
171 | 'entity_id' => [ | |
172 | 'name' => 'entity_id', | |
173 | 'type' => CRM_Utils_Type::T_INT, | |
174 | 'title' => ts('ACL Entity ID'), | |
175 | 'description' => ts('ID of the group/contact object being joined'), | |
176 | 'required' => TRUE, | |
177 | 'where' => 'civicrm_acl_entity_role.entity_id', | |
178 | 'table_name' => 'civicrm_acl_entity_role', | |
179 | 'entity' => 'ACLEntityRole', | |
180 | 'bao' => 'CRM_ACL_BAO_ACLEntityRole', | |
181 | 'localizable' => 0, | |
182 | 'add' => '1.6', | |
183 | ], | |
184 | 'is_active' => [ | |
185 | 'name' => 'is_active', | |
186 | 'type' => CRM_Utils_Type::T_BOOLEAN, | |
187 | 'title' => ts('ACL Entity Role is Active'), | |
188 | 'description' => ts('Is this property active?'), | |
c1e814c7 | 189 | 'required' => TRUE, |
58b85361 | 190 | 'where' => 'civicrm_acl_entity_role.is_active', |
e45b4707 | 191 | 'default' => '1', |
58b85361 MD |
192 | 'table_name' => 'civicrm_acl_entity_role', |
193 | 'entity' => 'ACLEntityRole', | |
194 | 'bao' => 'CRM_ACL_BAO_ACLEntityRole', | |
195 | 'localizable' => 0, | |
196 | 'add' => '1.6', | |
197 | ], | |
198 | ]; | |
199 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); | |
200 | } | |
201 | return Civi::$statics[__CLASS__]['fields']; | |
202 | } | |
203 | ||
204 | /** | |
205 | * Return a mapping from field-name to the corresponding key (as used in fields()). | |
206 | * | |
207 | * @return array | |
208 | * Array(string $name => string $uniqueName). | |
209 | */ | |
210 | public static function &fieldKeys() { | |
211 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { | |
212 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
213 | } | |
214 | return Civi::$statics[__CLASS__]['fieldKeys']; | |
215 | } | |
216 | ||
217 | /** | |
218 | * Returns the names of this table | |
219 | * | |
220 | * @return string | |
221 | */ | |
222 | public static function getTableName() { | |
223 | return self::$_tableName; | |
224 | } | |
225 | ||
226 | /** | |
227 | * Returns if this table needs to be logged | |
228 | * | |
229 | * @return bool | |
230 | */ | |
231 | public function getLog() { | |
232 | return self::$_log; | |
233 | } | |
234 | ||
235 | /** | |
236 | * Returns the list of fields that can be imported | |
237 | * | |
238 | * @param bool $prefix | |
239 | * | |
240 | * @return array | |
241 | */ | |
242 | public static function &import($prefix = FALSE) { | |
243 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'acl_entity_role', $prefix, []); | |
244 | return $r; | |
245 | } | |
246 | ||
247 | /** | |
248 | * Returns the list of fields that can be exported | |
249 | * | |
250 | * @param bool $prefix | |
251 | * | |
252 | * @return array | |
253 | */ | |
254 | public static function &export($prefix = FALSE) { | |
255 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'acl_entity_role', $prefix, []); | |
256 | return $r; | |
257 | } | |
258 | ||
259 | /** | |
260 | * Returns the list of indices | |
261 | * | |
262 | * @param bool $localize | |
263 | * | |
264 | * @return array | |
265 | */ | |
266 | public static function indices($localize = TRUE) { | |
267 | $indices = [ | |
268 | 'index_role' => [ | |
269 | 'name' => 'index_role', | |
270 | 'field' => [ | |
271 | 0 => 'acl_role_id', | |
272 | ], | |
273 | 'localizable' => FALSE, | |
274 | 'sig' => 'civicrm_acl_entity_role::0::acl_role_id', | |
275 | ], | |
276 | 'index_entity' => [ | |
277 | 'name' => 'index_entity', | |
278 | 'field' => [ | |
279 | 0 => 'entity_table', | |
280 | 1 => 'entity_id', | |
281 | ], | |
282 | 'localizable' => FALSE, | |
283 | 'sig' => 'civicrm_acl_entity_role::0::entity_table::entity_id', | |
284 | ], | |
285 | ]; | |
286 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; | |
287 | } | |
288 | ||
289 | } |