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/Core/EntityFile.xml | |
8 | * DO NOT EDIT. Generated by CRM_Core_CodeGen | |
28979d65 | 9 | * (GenCodeChecksum:d55d2dfbb297a954c71f0395e31a21d3) |
e501603b | 10 | */ |
c3fc2621 | 11 | |
f41f0342 | 12 | /** |
c3fc2621 | 13 | * Database access object for the EntityFile entity. |
f41f0342 | 14 | */ |
e501603b | 15 | class CRM_Core_DAO_EntityFile extends CRM_Core_DAO { |
929a1c14 CW |
16 | const EXT = 'civicrm'; |
17 | const TABLE_ADDED = '1.5'; | |
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_entity_file'; |
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 = TRUE; |
c3fc2621 | 32 | |
e501603b TO |
33 | /** |
34 | * primary key | |
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. | |
e501603b TO |
39 | */ |
40 | public $id; | |
c3fc2621 | 41 | |
e501603b TO |
42 | /** |
43 | * physical tablename for entity being joined to file, e.g. civicrm_contact | |
44 | * | |
28979d65 CW |
45 | * @var string|null |
46 | * (SQL type: varchar(64)) | |
47 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
48 | */ |
49 | public $entity_table; | |
c3fc2621 | 50 | |
e501603b TO |
51 | /** |
52 | * FK to entity table specified in entity_table column. | |
53 | * | |
28979d65 CW |
54 | * @var int|string |
55 | * (SQL type: int unsigned) | |
56 | * Note that values will be retrieved from the database as a string. | |
e501603b TO |
57 | */ |
58 | public $entity_id; | |
c3fc2621 | 59 | |
e501603b TO |
60 | /** |
61 | * FK to civicrm_file | |
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. | |
e501603b TO |
66 | */ |
67 | public $file_id; | |
c3fc2621 | 68 | |
e501603b | 69 | /** |
f41f0342 | 70 | * Class constructor. |
e501603b | 71 | */ |
c3fc2621 | 72 | public function __construct() { |
e501603b TO |
73 | $this->__table = 'civicrm_entity_file'; |
74 | parent::__construct(); | |
75 | } | |
c3fc2621 | 76 | |
449c4e6b CW |
77 | /** |
78 | * Returns localized title of this entity. | |
7b66c3b5 AH |
79 | * |
80 | * @param bool $plural | |
81 | * Whether to return the plural version of the title. | |
449c4e6b | 82 | */ |
7b66c3b5 AH |
83 | public static function getEntityTitle($plural = FALSE) { |
84 | return $plural ? ts('Entity Files') : ts('Entity File'); | |
449c4e6b CW |
85 | } |
86 | ||
e501603b | 87 | /** |
f41f0342 | 88 | * Returns foreign keys and entity references. |
e501603b TO |
89 | * |
90 | * @return array | |
91 | * [CRM_Core_Reference_Interface] | |
92 | */ | |
c3fc2621 | 93 | public static function getReferenceColumns() { |
346aaaba | 94 | if (!isset(Civi::$statics[__CLASS__]['links'])) { |
fa45b5b9 | 95 | Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__); |
c3fc2621 CW |
96 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'file_id', 'civicrm_file', 'id'); |
97 | Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table'); | |
346aaaba | 98 | CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']); |
e501603b | 99 | } |
346aaaba | 100 | return Civi::$statics[__CLASS__]['links']; |
e501603b | 101 | } |
c3fc2621 | 102 | |
e501603b TO |
103 | /** |
104 | * Returns all the column names of this table | |
105 | * | |
106 | * @return array | |
107 | */ | |
c3fc2621 | 108 | public static function &fields() { |
346aaaba | 109 | if (!isset(Civi::$statics[__CLASS__]['fields'])) { |
c3fc2621 CW |
110 | Civi::$statics[__CLASS__]['fields'] = [ |
111 | 'id' => [ | |
e501603b TO |
112 | 'name' => 'id', |
113 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 114 | 'title' => ts('Entity File ID'), |
215b423e | 115 | 'description' => ts('primary key'), |
c3fc2621 | 116 | 'required' => TRUE, |
a36434b9 | 117 | 'where' => 'civicrm_entity_file.id', |
522a26c9 | 118 | 'table_name' => 'civicrm_entity_file', |
119 | 'entity' => 'EntityFile', | |
120 | 'bao' => 'CRM_Core_DAO_EntityFile', | |
6a7e5e5d | 121 | 'localizable' => 0, |
2cbbebe8 A |
122 | 'html' => [ |
123 | 'type' => 'Number', | |
124 | ], | |
1fe423d6 | 125 | 'readonly' => TRUE, |
a9d0587b | 126 | 'add' => '1.5', |
c3fc2621 CW |
127 | ], |
128 | 'entity_table' => [ | |
e501603b TO |
129 | 'name' => 'entity_table', |
130 | 'type' => CRM_Utils_Type::T_STRING, | |
c3fc2621 | 131 | 'title' => ts('Entity Table'), |
215b423e | 132 | 'description' => ts('physical tablename for entity being joined to file, e.g. civicrm_contact'), |
e501603b TO |
133 | 'maxlength' => 64, |
134 | 'size' => CRM_Utils_Type::BIG, | |
a36434b9 | 135 | 'where' => 'civicrm_entity_file.entity_table', |
522a26c9 | 136 | 'table_name' => 'civicrm_entity_file', |
137 | 'entity' => 'EntityFile', | |
138 | 'bao' => 'CRM_Core_DAO_EntityFile', | |
6a7e5e5d | 139 | 'localizable' => 0, |
a9d0587b | 140 | 'add' => '1.5', |
c3fc2621 CW |
141 | ], |
142 | 'entity_id' => [ | |
e501603b TO |
143 | 'name' => 'entity_id', |
144 | 'type' => CRM_Utils_Type::T_INT, | |
c3fc2621 | 145 | 'title' => ts('Entity ID'), |
215b423e | 146 | 'description' => ts('FK to entity table specified in entity_table column.'), |
c3fc2621 | 147 | 'required' => TRUE, |
a36434b9 | 148 | 'where' => 'civicrm_entity_file.entity_id', |
522a26c9 | 149 | 'table_name' => 'civicrm_entity_file', |
150 | 'entity' => 'EntityFile', | |
151 | 'bao' => 'CRM_Core_DAO_EntityFile', | |
6a7e5e5d | 152 | 'localizable' => 0, |
a9d0587b | 153 | 'add' => '1.5', |
c3fc2621 CW |
154 | ], |
155 | 'file_id' => [ | |
e501603b TO |
156 | 'name' => 'file_id', |
157 | 'type' => CRM_Utils_Type::T_INT, | |
2cbbebe8 | 158 | 'title' => ts('File ID'), |
215b423e | 159 | 'description' => ts('FK to civicrm_file'), |
c3fc2621 | 160 | 'required' => TRUE, |
a36434b9 | 161 | 'where' => 'civicrm_entity_file.file_id', |
522a26c9 | 162 | 'table_name' => 'civicrm_entity_file', |
163 | 'entity' => 'EntityFile', | |
164 | 'bao' => 'CRM_Core_DAO_EntityFile', | |
6a7e5e5d | 165 | 'localizable' => 0, |
e501603b | 166 | 'FKClassName' => 'CRM_Core_DAO_File', |
2cbbebe8 A |
167 | 'html' => [ |
168 | 'label' => ts("File"), | |
169 | ], | |
a9d0587b | 170 | 'add' => '1.5', |
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__, 'entity_file', $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__, 'entity_file', $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 | 241 | $indices = [ |
90dcf8f8 | 242 | 'UI_entity_id_entity_table_file_id' => [ |
243 | 'name' => 'UI_entity_id_entity_table_file_id', | |
c3fc2621 | 244 | 'field' => [ |
90dcf8f8 | 245 | 0 => 'entity_id', |
246 | 1 => 'entity_table', | |
e7a6b91a | 247 | 2 => 'file_id', |
c3fc2621 CW |
248 | ], |
249 | 'localizable' => FALSE, | |
8506cda6 | 250 | 'unique' => TRUE, |
90dcf8f8 | 251 | 'sig' => 'civicrm_entity_file::1::entity_id::entity_table::file_id', |
c3fc2621 CW |
252 | ], |
253 | ]; | |
e7a6b91a AS |
254 | return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; |
255 | } | |
c3fc2621 | 256 | |
e501603b | 257 | } |