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:29535e630a2b0126ea96c998cee79332)
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 public static $_tableName = 'civicrm_entity_file';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = TRUE;
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 'where' => 'civicrm_entity_file.id',
98 'table_name' => 'civicrm_entity_file',
99 'entity' => 'EntityFile',
100 'bao' => 'CRM_Core_DAO_EntityFile',
104 'name' => 'entity_table',
105 'type' => CRM_Utils_Type
::T_STRING
,
106 'title' => ts('Entity Table'),
107 'description' => ts('physical tablename for entity being joined to file, e.g. civicrm_contact'),
109 'size' => CRM_Utils_Type
::BIG
,
110 'where' => 'civicrm_entity_file.entity_table',
111 'table_name' => 'civicrm_entity_file',
112 'entity' => 'EntityFile',
113 'bao' => 'CRM_Core_DAO_EntityFile',
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.'),
122 'where' => 'civicrm_entity_file.entity_id',
123 'table_name' => 'civicrm_entity_file',
124 'entity' => 'EntityFile',
125 'bao' => 'CRM_Core_DAO_EntityFile',
130 'type' => CRM_Utils_Type
::T_INT
,
131 'title' => ts('File'),
132 'description' => ts('FK to civicrm_file'),
134 'where' => 'civicrm_entity_file.file_id',
135 'table_name' => 'civicrm_entity_file',
136 'entity' => 'EntityFile',
137 'bao' => 'CRM_Core_DAO_EntityFile',
139 'FKClassName' => 'CRM_Core_DAO_File',
142 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
144 return Civi
::$statics[__CLASS__
]['fields'];
148 * Return a mapping from field-name to the corresponding key (as used in fields()).
151 * Array(string $name => string $uniqueName).
153 public static function &fieldKeys() {
154 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
155 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
157 return Civi
::$statics[__CLASS__
]['fieldKeys'];
161 * Returns the names of this table
165 public static function getTableName() {
166 return self
::$_tableName;
170 * Returns if this table needs to be logged
174 public function getLog() {
179 * Returns the list of fields that can be imported
181 * @param bool $prefix
185 public static function &import($prefix = FALSE) {
186 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'entity_file', $prefix, []);
191 * Returns the list of fields that can be exported
193 * @param bool $prefix
197 public static function &export($prefix = FALSE) {
198 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'entity_file', $prefix, []);
203 * Returns the list of indices
205 * @param bool $localize
209 public static function indices($localize = TRUE) {
212 'name' => 'index_entity',
217 'localizable' => FALSE,
218 'sig' => 'civicrm_entity_file::0::entity_table::entity_id',
220 'UI_entity_table_entity_id_file_id' => [
221 'name' => 'UI_entity_table_entity_id_file_id',
227 'localizable' => FALSE,
229 'sig' => 'civicrm_entity_file::1::entity_table::entity_id::file_id',
232 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;