Example #1
0
 /**
  * This function checks if there was any registraion for related event ids,
  * and returns array of ids with no regsitrations
  *
  * @param string or int or object... $eventID
  *
  * @return array
  */
 public static function checkRegistrationForEvents($eventID)
 {
     $eventIdsWithNoRegistration = array();
     if ($eventID) {
         $getRelatedEntities = CRM_Core_BAO_RecurringEntity::getEntitiesFor($eventID, 'civicrm_event', TRUE);
         $participantDetails = CRM_Event_Form_ManageEvent_Repeat::getParticipantCountforEvent($getRelatedEntities);
         //Check if participants exists for events
         foreach ($getRelatedEntities as $key => $value) {
             if (!CRM_Utils_Array::value($value['id'], $participantDetails['countByID']) && $value['id'] != $eventID) {
                 //CRM_Event_BAO_Event::del($value['id']);
                 $eventIdsWithNoRegistration[] = $value['id'];
             }
         }
     }
     CRM_Core_BAO_RecurringEntity::$_entitiesToBeDeleted = $eventIdsWithNoRegistration;
     return CRM_Core_BAO_RecurringEntity::$_entitiesToBeDeleted;
 }