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/Batch/EntityBatch.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
74db51d3 | 9 | * (GenCodeChecksum:cf1316450cf80689399a7f55bb3b4261) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the EntityBatch entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Batch_DAO_EntityBatch extends CRM_Core_DAO { |
c3fc2621 | 16 | |
e501603b | 17 | /** |
f41f0342 | 18 | * Static instance to hold the table name. |
e501603b TO |
19 | * |
20 | * @var string | |
21 | */ | |
fa45b5b9 | 22 | public static $_tableName = 'civicrm_entity_batch'; |
c3fc2621 | 23 | |
e501603b | 24 | /** |
f41f0342 | 25 | * Should CiviCRM log any modifications to this table in the civicrm_log table. |
e501603b | 26 | * |
c3fc2621 | 27 | * @var bool |
e501603b | 28 | */ |
fa45b5b9 | 29 | public static $_log = FALSE; |
c3fc2621 | 30 | |
e501603b TO |
31 | /** |
32 | * primary key | |
33 | * | |
e6ca0a57 | 34 | * @var int |
e501603b TO |
35 | */ |
36 | public $id; | |
c3fc2621 | 37 | |
e501603b TO |
38 | /** |
39 | * physical tablename for entity being joined to file, e.g. civicrm_contact | |
40 | * | |
41 | * @var string | |
42 | */ | |
43 | public $entity_table; | |
c3fc2621 | 44 | |
e501603b TO |
45 | /** |
46 | * FK to entity table specified in entity_table column. | |
47 | * | |
e6ca0a57 | 48 | * @var int |
e501603b TO |
49 | */ |
50 | public $entity_id; | |
c3fc2621 | 51 | |
e501603b TO |
52 | /** |
53 | * FK to civicrm_batch | |
54 | * | |
e6ca0a57 | 55 | * @var int |
e501603b TO |
56 | */ |
57 | public $batch_id; | |
c3fc2621 | 58 | |
e501603b | 59 | /** |
f41f0342 | 60 | * Class constructor. |
e501603b | 61 | */ |
c3fc2621 | 62 | public function __construct() { |
e501603b TO |
63 | $this->__table = 'civicrm_entity_batch'; |
64 | parent::__construct(); | |
65 | } | |
c3fc2621 | 66 | |
e501603b | 67 | /** |
f41f0342 | 68 | * Returns foreign keys and entity references. |
e501603b TO |
69 | * |
70 | * @return array | |
71 | * [CRM_Core_Reference_Interface] | |
72 | */ | |
c3fc2621 | 73 | public static function getReferenceColumns() { |
346aaaba | 74 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 75 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
76 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'batch_id', 'civicrm_batch', 'id'); |
77 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); | |
346aaaba | 78 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 79 | } |
346aaaba | 80 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 81 | } |
c3fc2621 | 82 | |
e501603b TO |
83 | /** |
84 | * Returns all the column names of this table | |
85 | * | |
86 | * @return array | |
87 | */ | |
c3fc2621 | 88 | public static function &fields() { |
346aaaba | 89 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
90 | Civi::$statics[__CLASS__]['fields'] = [ |
91 | 'id' => [ | |
e501603b TO |
92 | 'name' => 'id', |
93 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 94 | 'title' => ts('EntityBatch ID'), |
215b423e | 95 | 'description' => ts('primary key'), |
c3fc2621 | 96 | 'required' => TRUE, |
a36434b9 | 97 | 'where' => 'civicrm_entity_batch.id', |
522a26c9 | 98 | 'table_name' => 'civicrm_entity_batch', |
99 | 'entity' => 'EntityBatch', | |
100 | 'bao' => 'CRM_Batch_BAO_EntityBatch', | |
6a7e5e5d | 101 | 'localizable' => 0, |
c3fc2621 CW |
102 | ], |
103 | 'entity_table' => [ | |
e501603b TO |
104 | 'name' => 'entity_table', |
105 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 106 | 'title' => ts('EntityBatch Table'), |
215b423e | 107 | 'description' => ts('physical tablename for entity being joined to file, e.g. civicrm_contact'), |
e501603b TO |
108 | 'maxlength' => 64, |
109 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 110 | 'where' => 'civicrm_entity_batch.entity_table', |
522a26c9 | 111 | 'table_name' => 'civicrm_entity_batch', |
112 | 'entity' => 'EntityBatch', | |
113 | 'bao' => 'CRM_Batch_BAO_EntityBatch', | |
6a7e5e5d | 114 | 'localizable' => 0, |
c3fc2621 CW |
115 | ], |
116 | 'entity_id' => [ | |
e501603b TO |
117 | 'name' => 'entity_id', |
118 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 119 | 'title' => ts('Entity ID'), |
215b423e | 120 | 'description' => ts('FK to entity table specified in entity_table column.'), |
c3fc2621 | 121 | 'required' => TRUE, |
a36434b9 | 122 | 'where' => 'civicrm_entity_batch.entity_id', |
522a26c9 | 123 | 'table_name' => 'civicrm_entity_batch', |
124 | 'entity' => 'EntityBatch', | |
125 | 'bao' => 'CRM_Batch_BAO_EntityBatch', | |
6a7e5e5d | 126 | 'localizable' => 0, |
c3fc2621 CW |
127 | ], |
128 | 'batch_id' => [ | |
e501603b TO |
129 | 'name' => 'batch_id', |
130 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 131 | 'title' => ts('Batch ID'), |
215b423e | 132 | 'description' => ts('FK to civicrm_batch'), |
c3fc2621 | 133 | 'required' => TRUE, |
a36434b9 | 134 | 'where' => 'civicrm_entity_batch.batch_id', |
522a26c9 | 135 | 'table_name' => 'civicrm_entity_batch', |
136 | 'entity' => 'EntityBatch', | |
137 | 'bao' => 'CRM_Batch_BAO_EntityBatch', | |
6a7e5e5d | 138 | 'localizable' => 0, |
e501603b | 139 | 'FKClassName' => 'CRM_Batch_DAO_Batch', |
c3fc2621 | 140 | 'pseudoconstant' => [ |
c76af7c4 E |
141 | 'table' => 'civicrm_batch', |
142 | 'keyColumn' => 'id', | |
143 | 'labelColumn' => 'title', | |
e6ca0a57 | 144 | ], |
c3fc2621 CW |
145 | ], |
146 | ]; | |
346aaaba | 147 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); |
e501603b | 148 | } |
346aaaba | 149 | return Civi::$statics[__CLASS__]['fields']; |
e501603b | 150 | } |
c3fc2621 | 151 | |
e501603b | 152 | /** |
bd8e0b14 | 153 | * Return a mapping from field-name to the corresponding key (as used in fields()). |
e501603b TO |
154 | * |
155 | * @return array | |
bd8e0b14 | 156 | * Array(string $name => string $uniqueName). |
e501603b | 157 | */ |
c3fc2621 | 158 | public static function &fieldKeys() { |
bd8e0b14 TO |
159 | if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) { |
160 | Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields())); | |
e501603b | 161 | } |
bd8e0b14 | 162 | return Civi::$statics[__CLASS__]['fieldKeys']; |
e501603b | 163 | } |
c3fc2621 | 164 | |
e501603b TO |
165 | /** |
166 | * Returns the names of this table | |
167 | * | |
168 | * @return string | |
169 | */ | |
c3fc2621 | 170 | public static function getTableName() { |
e501603b TO |
171 | return self::$_tableName; |
172 | } | |
c3fc2621 | 173 | |
e501603b TO |
174 | /** |
175 | * Returns if this table needs to be logged | |
176 | * | |
c3fc2621 | 177 | * @return bool |
e501603b | 178 | */ |
c3fc2621 | 179 | public function getLog() { |
e501603b TO |
180 | return self::$_log; |
181 | } | |
c3fc2621 | 182 | |
e501603b TO |
183 | /** |
184 | * Returns the list of fields that can be imported | |
185 | * | |
186 | * @param bool $prefix | |
187 | * | |
188 | * @return array | |
189 | */ | |
c3fc2621 CW |
190 | public static function &import($prefix = FALSE) { |
191 | $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_batch', $prefix, []); | |
60808919 | 192 | return $r; |
e501603b | 193 | } |
c3fc2621 | 194 | |
e501603b TO |
195 | /** |
196 | * Returns the list of fields that can be exported | |
197 | * | |
198 | * @param bool $prefix | |
199 | * | |
200 | * @return array | |
201 | */ | |
c3fc2621 CW |
202 | public static function &export($prefix = FALSE) { |
203 | $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_batch', $prefix, []); | |
60808919 | 204 | return $r; |
e501603b | 205 | } |
c3fc2621 | 206 | |
e7a6b91a AS |
207 | /** |
208 | * Returns the list of indices | |
c3fc2621 CW |
209 | * |
210 | * @param bool $localize | |
211 | * | |
212 | * @return array | |
e7a6b91a AS |
213 | */ |
214 | public static function indices($localize = TRUE) { | |
c3fc2621 CW |
215 | $indices = [ |
216 | 'index_entity' => [ | |
e7a6b91a | 217 | 'name' => 'index_entity', |
c3fc2621 | 218 | 'field' => [ |
e7a6b91a AS |
219 | 0 => 'entity_table', |
220 | 1 => 'entity_id', | |
c3fc2621 CW |
221 | ], |
222 | 'localizable' => FALSE, | |
e7a6b91a | 223 | 'sig' => 'civicrm_entity_batch::0::entity_table::entity_id', |
c3fc2621 CW |
224 | ], |
225 | 'UI_batch_entity' => [ | |
e7a6b91a | 226 | 'name' => 'UI_batch_entity', |
c3fc2621 | 227 | 'field' => [ |
e7a6b91a AS |
228 | 0 => 'batch_id', |
229 | 1 => 'entity_id', | |
230 | 2 => 'entity_table', | |
c3fc2621 CW |
231 | ], |
232 | 'localizable' => FALSE, | |
233 | 'unique' => TRUE, | |
e7a6b91a | 234 | 'sig' => 'civicrm_entity_batch::1::batch_id::entity_id::entity_table', |
c3fc2621 CW |
235 | ], |
236 | ]; | |
e7a6b91a AS |
237 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
238 | } | |
c3fc2621 | 239 | |
e501603b | 240 | } |