public function deletefavouriteAction() { $fav = $this->byId(null, 'PanelFavourite'); if ($fav) { $this->dbService->delete($fav); } echo $this->ajaxResponse($fav->id); }
/** * Delete the tags for the given object * * @param object $item */ public function deleteTags($item) { $type = mb_strtolower(get_class($item)); $id = (int) $item->id; // okay, delete ahoy $this->dbService->delete('tag', 'itemtype=' . $this->dbService->quote($type) . ' and itemid=' . $id); }
/** * Deletes a file object from the system * * @param File $file * @return boolean */ public function deleteFile(File $file) { if (!$this->removeFile($file->path . DIRECTORY_SEPARATOR . $file->filename)) { $this->log->debug("Failed to delete file " . $file->filename); return false; } return $this->dbService->delete($file); }
/** * Delete a feature and all sub features. */ public function deleteFeature(Feature $feature) { $this->dbService->beginTransaction(); $childFeatures = $this->getChildFeatures($feature); foreach ($childFeatures as $child) { $this->deleteFeature($child); } $this->dbService->delete($feature); $this->dbService->commit(); }
/** * Deletes an item */ public function deleteItem($item) { try { $this->dbService->beginTransaction(); $this->dbService->delete('itemlink', 'toid = ' . $item->id . ' OR fromid = ' . $item->id); $this->dbService->commit(); } catch (Exception $e) { $this->log->error("Failed deleting item " . get_class($item) . ' #' . $item->id); $this->dbService->rollback(); } }
/** * Removes a timesheet record from the system */ public function removeTimesheetRecord(TimesheetRecord $record) { $task = $this->getTask($record->taskid); if (!$task) { throw new Exception("Cannot delete time from non-existent task"); } $this->dbService->beginTransaction(); $this->dbService->delete($record); $this->updateTaskTime($task); $this->dbService->commit(); }
/** * Deletes the specified object. */ public function deleteAction() { if ((int) $this->_getParam('id')) { $model = $this->byId(); if ($model) { $this->dbService->delete($model); } } else { throw new Exception("No object specified"); } $this->onModelDeleted($model); }
/** * Remove access from a particular item * * @param object $item the item to remove access from * @param String $user The user to remove access for * @param String $role The role to remove (optional) */ public function removeAccess($item, $user, $role = null) { if (!$item) { throw new Exception("Cannot remove access from null object"); } $fields = array('itemid' => $item->id, 'itemtype' => get_class($item), 'authority' => $user->getUsername()); if ($role != null) { $fields['role'] = $role; } $existing = $this->dbService->getByField($fields, 'UserRole'); if ($existing != null) { // delete away $this->dbService->delete($existing); } }
/** * Remove a watch * * @param CrmUser $user * @param int $id * @param string $type */ public function removeWatch($user, $id, $type) { // just delete direct, no need to get the // object first... $this->dbService->delete('itemwatch', "userid=" . $this->dbService->quote($user->username) . " AND itemid={$id} AND itemtype='{$type}'"); }