Merge pull request #13887 from eileenmcnaughton/group_entity
[civicrm-core.git] / CRM / Core / BAO / File.php
index 8845687292fbf8bed66c72edd028a0c2b738c570..c2c06bd279fbc166fe15af0537e3f7c2afe6d840 100644 (file)
@@ -38,7 +38,7 @@
  */
 class CRM_Core_BAO_File extends CRM_Core_DAO_File {
 
-  static $_signableFields = ['entityTable', 'entityID', 'fileID'];
+  public static $_signableFields = ['entityTable', 'entityID', 'fileID'];
 
   /**
    * Takes an associative array and creates a File object.
@@ -95,7 +95,6 @@ class CRM_Core_BAO_File extends CRM_Core_DAO_File {
     return [NULL, NULL];
   }
 
-
   /**
    * @param $data
    * @param int $fileTypeID
@@ -211,7 +210,7 @@ class CRM_Core_BAO_File extends CRM_Core_DAO_File {
     $fileDAO = new CRM_Core_DAO_File();
     $fileDAO->id = $fileID;
     if (!$fileDAO->find(TRUE)) {
-      CRM_Core_Error::fatal();
+      throw new CRM_Core_Exception(ts('File not found'));
     }
 
     // lets call a pre hook before the delete, so attachments hooks can get the info before things
@@ -227,7 +226,7 @@ class CRM_Core_BAO_File extends CRM_Core_DAO_File {
     $entityFileDAO->entity_table = $tableName;
 
     if (!$entityFileDAO->find(TRUE)) {
-      CRM_Core_Error::fatal(sprintf('No record found for given file ID - %d and entity ID - %d', $fileID, $entityID));
+      throw new CRM_Core_Exception(sprintf('No record found for given file ID - %d and entity ID - %d', $fileID, $entityID));
     }
 
     $entityFileDAO->delete();
@@ -695,7 +694,6 @@ AND       CEF.entity_id    = %2";
     self::deleteEntityFile($params['entityTable'], $params['entityID'], NULL, $params['fileID']);
   }
 
-
   /**
    * Display paper icon for a file attachment -- CRM-13624
    *
@@ -772,6 +770,8 @@ AND       CEF.entity_id    = %2";
    *
    * @param int $entityId entity id the file is attached to
    * @param int $fileId file ID
+   * @param int $genTs
+   * @param int $life
    * @return string
    */
   public static function generateFileHash($entityId = NULL, $fileId = NULL, $genTs = NULL, $life = NULL) {