/** * Drop selected status update * * @param void * @return null */ function delete() { if ($this->active_status_update->isNew()) { $this->httpError(HTTP_ERR_NOT_FOUND); } // if if (!$this->active_status_update->canDelete($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN); } // if if ($this->request->isSubmitted()) { $delete = $this->active_status_update->delete(); if ($delete && !is_error($delete)) { if ($this->request->isApiCall()) { $this->httpOk(); } else { flash_success('Selected status update has been successfully deleted'); } // if } else { if ($this->request->isApiCall()) { $this->serveData($delete); } else { flash_success('Failed to delete selected status update'); } // if } // if $this->redirectToReferer(assemble_url('status_updates')); } else { $this->httpError(HTTP_ERR_BAD_REQUEST); } // if }
/** * Drop all status messages by parent * * @param StatusUpdate $parent * @return boolean */ function dropByParent($parent) { return StatusUpdates::delete(array('parent_id = ?', $parent->getId())); }