5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Core/EntityFile.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:febc5ccbfb965f8f4ba8477d4db0e5f3)
13 * Database access object for the EntityFile entity.
15 class CRM_Core_DAO_EntityFile
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 static $_tableName = 'civicrm_entity_file';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
39 * physical tablename for entity being joined to file, e.g. civicrm_contact
46 * FK to entity table specified in entity_table column.
62 public function __construct() {
63 $this->__table
= 'civicrm_entity_file';
64 parent
::__construct();
68 * Returns foreign keys and entity references.
71 * [CRM_Core_Reference_Interface]
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(), 'file_id', 'civicrm_file', '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']);
80 return Civi
::$statics[__CLASS__
]['links'];
84 * Returns all the column names of this table
88 public static function &fields() {
89 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
90 Civi
::$statics[__CLASS__
]['fields'] = [
93 'type' => CRM_Utils_Type
::T_INT
,
94 'title' => ts('Entity File ID'),
95 'description' => ts('primary key'),
97 'table_name' => 'civicrm_entity_file',
98 'entity' => 'EntityFile',
99 'bao' => 'CRM_Core_DAO_EntityFile',
103 'name' => 'entity_table',
104 'type' => CRM_Utils_Type
::T_STRING
,
105 'title' => ts('Entity Table'),
106 'description' => ts('physical tablename for entity being joined to file, e.g. civicrm_contact'),
108 'size' => CRM_Utils_Type
::BIG
,
109 'table_name' => 'civicrm_entity_file',
110 'entity' => 'EntityFile',
111 'bao' => 'CRM_Core_DAO_EntityFile',
115 'name' => 'entity_id',
116 'type' => CRM_Utils_Type
::T_INT
,
117 'title' => ts('Entity ID'),
118 'description' => ts('FK to entity table specified in entity_table column.'),
120 'table_name' => 'civicrm_entity_file',
121 'entity' => 'EntityFile',
122 'bao' => 'CRM_Core_DAO_EntityFile',
127 'type' => CRM_Utils_Type
::T_INT
,
128 'title' => ts('File'),
129 'description' => ts('FK to civicrm_file'),
131 'table_name' => 'civicrm_entity_file',
132 'entity' => 'EntityFile',
133 'bao' => 'CRM_Core_DAO_EntityFile',
135 'FKClassName' => 'CRM_Core_DAO_File',
138 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
140 return Civi
::$statics[__CLASS__
]['fields'];
144 * Return a mapping from field-name to the corresponding key (as used in fields()).
147 * Array(string $name => string $uniqueName).
149 public static function &fieldKeys() {
150 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
151 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
153 return Civi
::$statics[__CLASS__
]['fieldKeys'];
157 * Returns the names of this table
161 public static function getTableName() {
162 return self
::$_tableName;
166 * Returns if this table needs to be logged
170 public function getLog() {
175 * Returns the list of fields that can be imported
177 * @param bool $prefix
181 public static function &import($prefix = FALSE) {
182 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'entity_file', $prefix, []);
187 * Returns the list of fields that can be exported
189 * @param bool $prefix
193 public static function &export($prefix = FALSE) {
194 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'entity_file', $prefix, []);
199 * Returns the list of indices
201 * @param bool $localize
205 public static function indices($localize = TRUE) {
208 'name' => 'index_entity',
213 'localizable' => FALSE,
214 'sig' => 'civicrm_entity_file::0::entity_table::entity_id',
216 'UI_entity_table_entity_id_file_id' => [
217 'name' => 'UI_entity_table_entity_id_file_id',
223 'localizable' => FALSE,
225 'sig' => 'civicrm_entity_file::1::entity_table::entity_id::file_id',
228 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;