INFRA-132 - Batch #8
[civicrm-core.git] / Civi / CCase / Events.php
index 472ac9f6471312a7616dcd6dcb7b2fb3f1e85463..88b11c5ff99e9a00fe8a76388398affcafe45233 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -48,9 +48,15 @@ class Events {
           $caseId = $event->object->case_id;
         }
         break;
+
       case 'Case':
-        $caseId = $event->id;
+        // by the time we get the post-delete event, the record is gone, so
+        // there's nothing to analyze
+        if ($event->action != 'delete') {
+          $caseId = $event->id;
+        }
         break;
+
       default:
         throw new \CRM_Core_Exception("CRM_Case_Listener does not support entity {$event->entity}");
     }
@@ -81,7 +87,7 @@ class Events {
   /**
    * Find any extra listeners declared in XML and pass the event along to them
    *
-   * @param Event\CaseChangeEvent $event
+   * @param \Civi\CCase\Event\CaseChangeEvent $event
    */
   public static function delegateToXmlListeners(\Civi\CCase\Event\CaseChangeEvent $event) {
     $p = new \CRM_Case_XMLProcessor_Process();
@@ -91,4 +97,4 @@ class Events {
       $listener->onCaseChange($event);
     }
   }
-}
\ No newline at end of file
+}