You are here

public function WebformCivicrmBase::getAttachments in Webform CiviCRM Integration 8.5

FIXME: Use the api for this

Parameters

string $ent - entity type:

int $id - entity id:

Return value

array starting at index 1

2 calls to WebformCivicrmBase::getAttachments()
WebformCivicrmPostProcess::processAttachments in src/WebformCivicrmPostProcess.php
WebformCivicrmPreProcess::populateExistingEntity in src/WebformCivicrmPreProcess.php
Populate existing entity data

File

src/WebformCivicrmBase.php, line 838
Front-end form handler base class.

Class

WebformCivicrmBase
Class WebformCivicrmBase

Namespace

Drupal\webform_civicrm

Code

public function getAttachments($ent, $id) {
  $n = 1;
  $attachments = [];
  $dao = \CRM_Core_DAO::executeQuery("SELECT * FROM civicrm_entity_file WHERE entity_table = 'civicrm_{$ent}' AND entity_id = {$id}");
  while ($dao
    ->fetch()) {
    $attachments[$n++] = [
      'id' => $dao->id,
      'file_id' => $dao->file_id,
    ];
  }
  return $attachments;
}