5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/EntityFile.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:d55d2dfbb297a954c71f0395e31a21d3)
13 * Database access object for the EntityFile entity.
15 class CRM_Core_DAO_EntityFile
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '1.5';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_entity_file';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = TRUE;
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
43 * physical tablename for entity being joined to file, e.g. civicrm_contact
46 * (SQL type: varchar(64))
47 * Note that values will be retrieved from the database as a string.
52 * FK to entity table specified in entity_table column.
55 * (SQL type: int unsigned)
56 * Note that values will be retrieved from the database as a string.
64 * (SQL type: int unsigned)
65 * Note that values will be retrieved from the database as a string.
72 public function __construct() {
73 $this->__table
= 'civicrm_entity_file';
74 parent
::__construct();
78 * Returns localized title of this entity.
81 * Whether to return the plural version of the title.
83 public static function getEntityTitle($plural = FALSE) {
84 return $plural ?
ts('Entity Files') : ts('Entity File');
88 * Returns foreign keys and entity references.
91 * [CRM_Core_Reference_Interface]
93 public static function getReferenceColumns() {
94 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
95 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
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');
98 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
100 return Civi
::$statics[__CLASS__
]['links'];
104 * Returns all the column names of this table
108 public static function &fields() {
109 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
110 Civi
::$statics[__CLASS__
]['fields'] = [
113 'type' => CRM_Utils_Type
::T_INT
,
114 'title' => ts('Entity File ID'),
115 'description' => ts('primary key'),
117 'where' => 'civicrm_entity_file.id',
118 'table_name' => 'civicrm_entity_file',
119 'entity' => 'EntityFile',
120 'bao' => 'CRM_Core_DAO_EntityFile',
129 'name' => 'entity_table',
130 'type' => CRM_Utils_Type
::T_STRING
,
131 'title' => ts('Entity Table'),
132 'description' => ts('physical tablename for entity being joined to file, e.g. civicrm_contact'),
134 'size' => CRM_Utils_Type
::BIG
,
135 'where' => 'civicrm_entity_file.entity_table',
136 'table_name' => 'civicrm_entity_file',
137 'entity' => 'EntityFile',
138 'bao' => 'CRM_Core_DAO_EntityFile',
143 'name' => 'entity_id',
144 'type' => CRM_Utils_Type
::T_INT
,
145 'title' => ts('Entity ID'),
146 'description' => ts('FK to entity table specified in entity_table column.'),
148 'where' => 'civicrm_entity_file.entity_id',
149 'table_name' => 'civicrm_entity_file',
150 'entity' => 'EntityFile',
151 'bao' => 'CRM_Core_DAO_EntityFile',
157 'type' => CRM_Utils_Type
::T_INT
,
158 'title' => ts('File ID'),
159 'description' => ts('FK to civicrm_file'),
161 'where' => 'civicrm_entity_file.file_id',
162 'table_name' => 'civicrm_entity_file',
163 'entity' => 'EntityFile',
164 'bao' => 'CRM_Core_DAO_EntityFile',
166 'FKClassName' => 'CRM_Core_DAO_File',
168 'label' => ts("File"),
173 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
175 return Civi
::$statics[__CLASS__
]['fields'];
179 * Return a mapping from field-name to the corresponding key (as used in fields()).
182 * Array(string $name => string $uniqueName).
184 public static function &fieldKeys() {
185 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
186 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
188 return Civi
::$statics[__CLASS__
]['fieldKeys'];
192 * Returns the names of this table
196 public static function getTableName() {
197 return self
::$_tableName;
201 * Returns if this table needs to be logged
205 public function getLog() {
210 * Returns the list of fields that can be imported
212 * @param bool $prefix
216 public static function &import($prefix = FALSE) {
217 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'entity_file', $prefix, []);
222 * Returns the list of fields that can be exported
224 * @param bool $prefix
228 public static function &export($prefix = FALSE) {
229 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'entity_file', $prefix, []);
234 * Returns the list of indices
236 * @param bool $localize
240 public static function indices($localize = TRUE) {
242 'UI_entity_id_entity_table_file_id' => [
243 'name' => 'UI_entity_id_entity_table_file_id',
249 'localizable' => FALSE,
251 'sig' => 'civicrm_entity_file::1::entity_id::entity_table::file_id',
254 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;