Example #1
0
 /**
  * Deletes one or more mailings
  *
  * @param mixed $ids The ids to delete.
  */
 public static function deleteMailings($ids)
 {
     // if $ids is not an array, make one
     $ids = !is_array($ids) ? array($ids) : $ids;
     /*
      * I know this is messy, but since you can remove multiple mailings at
      * the same time in the datagrid ànd remove the record in CM we need to
      * loop the ID's one by one
      */
     // loop the list
     foreach ($ids as $id) {
         /*
             Depending on when you call this method it may or may not trigger an exception due
             to emails no longer existing with CM. That's why this bit is in a try/catch.
         */
         try {
             self::getCM()->deleteCampaign(self::getCampaignMonitorID('campaign', $id));
         } catch (\Exception $e) {
             // ignore exception
         }
         BackendMailmotorModel::delete($id);
     }
 }