/**
  * Delete a collection
  *
  * @apiMethod DELETE
  * @apiUri    /collections/{id}
  * @apiParameter {
  * 		"name":        "id",
  * 		"description": "Entry identifier",
  * 		"type":        "integer",
  * 		"required":    true,
  * 		"default":     null
  * }
  * @return    void
  */
 public function deleteTask()
 {
     $this->requiresAuthentication();
     $ids = Request::getVar('id', array());
     $ids = !is_array($ids) ? array($ids) : $ids;
     if (count($ids) <= 0) {
         throw new Exception(Lang::txt('COM_COLLECTIONS_ERROR_MISSING_ID'), 500);
     }
     foreach ($ids as $id) {
         $row = new Collection(intval($id));
         if (!$row->exists()) {
             throw new Exception(Lang::txt('COM_COLLECTIONS_ERROR_MISSING_RECORD'), 404);
         }
         if (!$row->delete()) {
             throw new Exception($row->getError(), 500);
         }
     }
     $this->send(null, 204);
 }
 /**
  * Delete one or more entries
  *
  * @return  void
  */
 public function removeTask()
 {
     // Check for request forgeries
     Request::checkToken();
     // Incoming
     $ids = Request::getVar('id', array());
     $ids = !is_array($ids) ? array($ids) : $ids;
     if (count($ids) > 0) {
         // Loop through all the IDs
         foreach ($ids as $id) {
             $entry = new Collection(intval($id));
             // Delete the entry
             if (!$entry->delete()) {
                 $this->setError($entry->getError());
             }
         }
     }
     // Set the redirect
     App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), $this->getError() ? implode('<br />', $this->getErrors()) : Lang::txt('COM_COLLECTIONS_ITEMS_DELETED'), $this->getError() ? 'error' : null);
 }