Regenerate DAO files
[civicrm-core.git] / CRM / Batch / DAO / EntityBatch.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Batch/EntityBatch.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:12e2c6e8e3c0890f0531819aebcfc543)
10 */
11
12 /**
13 * Database access object for the EntityBatch entity.
14 */
15 class CRM_Batch_DAO_EntityBatch extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_entity_batch';
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 * primary key
33 *
34 * @var int
35 */
36 public $id;
37
38 /**
39 * physical tablename for entity being joined to file, e.g. civicrm_contact
40 *
41 * @var string
42 */
43 public $entity_table;
44
45 /**
46 * FK to entity table specified in entity_table column.
47 *
48 * @var int
49 */
50 public $entity_id;
51
52 /**
53 * FK to civicrm_batch
54 *
55 * @var int
56 */
57 public $batch_id;
58
59 /**
60 * Class constructor.
61 */
62 public function __construct() {
63 $this->__table = 'civicrm_entity_batch';
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(), 'batch_id', 'civicrm_batch', 'id');
77 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
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('EntityBatch ID'),
95 'description' => ts('primary key'),
96 'required' => TRUE,
97 'where' => 'civicrm_entity_batch.id',
98 'table_name' => 'civicrm_entity_batch',
99 'entity' => 'EntityBatch',
100 'bao' => 'CRM_Batch_BAO_EntityBatch',
101 'localizable' => 0,
102 ],
103 'entity_table' => [
104 'name' => 'entity_table',
105 'type' => CRM_Utils_Type::T_STRING,
106 'title' => ts('EntityBatch Table'),
107 'description' => ts('physical tablename for entity being joined to file, e.g. civicrm_contact'),
108 'maxlength' => 64,
109 'size' => CRM_Utils_Type::BIG,
110 'where' => 'civicrm_entity_batch.entity_table',
111 'table_name' => 'civicrm_entity_batch',
112 'entity' => 'EntityBatch',
113 'bao' => 'CRM_Batch_BAO_EntityBatch',
114 'localizable' => 0,
115 ],
116 'entity_id' => [
117 'name' => 'entity_id',
118 'type' => CRM_Utils_Type::T_INT,
119 'title' => ts('Entity ID'),
120 'description' => ts('FK to entity table specified in entity_table column.'),
121 'required' => TRUE,
122 'where' => 'civicrm_entity_batch.entity_id',
123 'table_name' => 'civicrm_entity_batch',
124 'entity' => 'EntityBatch',
125 'bao' => 'CRM_Batch_BAO_EntityBatch',
126 'localizable' => 0,
127 ],
128 'batch_id' => [
129 'name' => 'batch_id',
130 'type' => CRM_Utils_Type::T_INT,
131 'title' => ts('Batch ID'),
132 'description' => ts('FK to civicrm_batch'),
133 'required' => TRUE,
134 'where' => 'civicrm_entity_batch.batch_id',
135 'table_name' => 'civicrm_entity_batch',
136 'entity' => 'EntityBatch',
137 'bao' => 'CRM_Batch_BAO_EntityBatch',
138 'localizable' => 0,
139 'FKClassName' => 'CRM_Batch_DAO_Batch',
140 'pseudoconstant' => [
141 'table' => 'civicrm_batch',
142 'keyColumn' => 'id',
143 'labelColumn' => 'title',
144 ],
145 ],
146 ];
147 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
148 }
149 return Civi::$statics[__CLASS__]['fields'];
150 }
151
152 /**
153 * Return a mapping from field-name to the corresponding key (as used in fields()).
154 *
155 * @return array
156 * Array(string $name => string $uniqueName).
157 */
158 public static function &fieldKeys() {
159 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
160 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
161 }
162 return Civi::$statics[__CLASS__]['fieldKeys'];
163 }
164
165 /**
166 * Returns the names of this table
167 *
168 * @return string
169 */
170 public static function getTableName() {
171 return self::$_tableName;
172 }
173
174 /**
175 * Returns if this table needs to be logged
176 *
177 * @return bool
178 */
179 public function getLog() {
180 return self::$_log;
181 }
182
183 /**
184 * Returns the list of fields that can be imported
185 *
186 * @param bool $prefix
187 *
188 * @return array
189 */
190 public static function &import($prefix = FALSE) {
191 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'entity_batch', $prefix, []);
192 return $r;
193 }
194
195 /**
196 * Returns the list of fields that can be exported
197 *
198 * @param bool $prefix
199 *
200 * @return array
201 */
202 public static function &export($prefix = FALSE) {
203 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'entity_batch', $prefix, []);
204 return $r;
205 }
206
207 /**
208 * Returns the list of indices
209 *
210 * @param bool $localize
211 *
212 * @return array
213 */
214 public static function indices($localize = TRUE) {
215 $indices = [
216 'index_entity' => [
217 'name' => 'index_entity',
218 'field' => [
219 0 => 'entity_table',
220 1 => 'entity_id',
221 ],
222 'localizable' => FALSE,
223 'sig' => 'civicrm_entity_batch::0::entity_table::entity_id',
224 ],
225 'UI_batch_entity' => [
226 'name' => 'UI_batch_entity',
227 'field' => [
228 0 => 'batch_id',
229 1 => 'entity_id',
230 2 => 'entity_table',
231 ],
232 'localizable' => FALSE,
233 'unique' => TRUE,
234 'sig' => 'civicrm_entity_batch::1::batch_id::entity_id::entity_table',
235 ],
236 ];
237 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
238 }
239
240 }