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