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:9f53de4bc8c3551092104bbb880cca60)
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 localized title of this entity.
70 public static function getEntityTitle() {
71 return ts('Entity Files');
75 * Returns foreign keys and entity references.
78 * [CRM_Core_Reference_Interface]
80 public static function getReferenceColumns() {
81 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
82 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
83 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'file_id', 'civicrm_file', 'id');
84 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
85 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
87 return Civi
::$statics[__CLASS__
]['links'];
91 * Returns all the column names of this table
95 public static function &fields() {
96 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
97 Civi
::$statics[__CLASS__
]['fields'] = [
100 'type' => CRM_Utils_Type
::T_INT
,
101 'title' => ts('Entity File ID'),
102 'description' => ts('primary key'),
104 'where' => 'civicrm_entity_file.id',
105 'table_name' => 'civicrm_entity_file',
106 'entity' => 'EntityFile',
107 'bao' => 'CRM_Core_DAO_EntityFile',
111 'name' => 'entity_table',
112 'type' => CRM_Utils_Type
::T_STRING
,
113 'title' => ts('Entity Table'),
114 'description' => ts('physical tablename for entity being joined to file, e.g. civicrm_contact'),
116 'size' => CRM_Utils_Type
::BIG
,
117 'where' => 'civicrm_entity_file.entity_table',
118 'table_name' => 'civicrm_entity_file',
119 'entity' => 'EntityFile',
120 'bao' => 'CRM_Core_DAO_EntityFile',
124 'name' => 'entity_id',
125 'type' => CRM_Utils_Type
::T_INT
,
126 'title' => ts('Entity ID'),
127 'description' => ts('FK to entity table specified in entity_table column.'),
129 'where' => 'civicrm_entity_file.entity_id',
130 'table_name' => 'civicrm_entity_file',
131 'entity' => 'EntityFile',
132 'bao' => 'CRM_Core_DAO_EntityFile',
137 'type' => CRM_Utils_Type
::T_INT
,
138 'title' => ts('File'),
139 'description' => ts('FK to civicrm_file'),
141 'where' => 'civicrm_entity_file.file_id',
142 'table_name' => 'civicrm_entity_file',
143 'entity' => 'EntityFile',
144 'bao' => 'CRM_Core_DAO_EntityFile',
146 'FKClassName' => 'CRM_Core_DAO_File',
149 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
151 return Civi
::$statics[__CLASS__
]['fields'];
155 * Return a mapping from field-name to the corresponding key (as used in fields()).
158 * Array(string $name => string $uniqueName).
160 public static function &fieldKeys() {
161 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
162 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
164 return Civi
::$statics[__CLASS__
]['fieldKeys'];
168 * Returns the names of this table
172 public static function getTableName() {
173 return self
::$_tableName;
177 * Returns if this table needs to be logged
181 public function getLog() {
186 * Returns the list of fields that can be imported
188 * @param bool $prefix
192 public static function &import($prefix = FALSE) {
193 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'entity_file', $prefix, []);
198 * Returns the list of fields that can be exported
200 * @param bool $prefix
204 public static function &export($prefix = FALSE) {
205 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'entity_file', $prefix, []);
210 * Returns the list of indices
212 * @param bool $localize
216 public static function indices($localize = TRUE) {
219 'name' => 'index_entity',
224 'localizable' => FALSE,
225 'sig' => 'civicrm_entity_file::0::entity_table::entity_id',
227 'UI_entity_table_entity_id_file_id' => [
228 'name' => 'UI_entity_table_entity_id_file_id',
234 'localizable' => FALSE,
236 'sig' => 'civicrm_entity_file::1::entity_table::entity_id::file_id',
239 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;