本文整理汇总了PHP中Model::destroy方法的典型用法代码示例。如果您正苦于以下问题:PHP Model::destroy方法的具体用法?PHP Model::destroy怎么用?PHP Model::destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model
的用法示例。
在下文中一共展示了Model::destroy方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* Find and delete a resource by ID.
*
* @param int $id
* @return bool
*/
public function delete($id)
{
$this->fireEvent('deleting', [$id]);
$deleted = $this->model->destroy($id);
$this->fireEvent('deleted', [$id, $deleted]);
return $deleted;
}
示例2: destroy
public static function destroy($params)
{
// Get delete position
$deletePosition = $params["data"][0]["stepNumber"];
// Destroy recipe step
$returnArray = parent::destroy($params);
// Check if we need to re-order existing steps
if (isset($params["reorder"]) && $params["reorder"] == TRUE) {
// Connect to database
$mysqli = FoodAppDatabase::connect();
// Update current data - decrement step numbers above insert position
$queryString = "SELECT * FROM recipe_step WHERE food_id='" . $params["data"][0]["foodId"] . "' " . "ORDER BY step_number ASC";
if ($result = $mysqli->query($queryString)) {
while ($row = $result->fetch_assoc()) {
// Update current data
if ($row["step_number"] > $deletePosition) {
$queryStringUpdate = "UPDATE recipe_step SET step_number='" . ($row["step_number"] - 1) . "' WHERE id='" . $row["id"] . "'";
if (!$mysqli->query($queryStringUpdate)) {
throw new Exception($mysqli->error);
}
}
}
}
}
return $returnArray;
}
示例3: delete
static function delete($attachment_id, $file = true)
{
if ($file) {
$attachment = new self($attachment_id);
@unlink(uploaded($attachment->path, true));
}
parent::destroy(get_class(), $attachment_id);
}
示例4: delete
/**
* Function: delete
* See Also:
* <Model::destroy>
*/
static function delete($id)
{
parent::destroy(get_class(), $id);
SQL::current()->delete("post_attributes", array("post_id" => $id));
}
示例5: delete
/**
* Function: delete
* Deletes the given milestone. Calls the "delete_milestone" trigger and passes the <Milestone> as an argument.
*
* Parameters:
* $id - The milestone to delete.
*/
static function delete($id)
{
parent::destroy(get_class(), $id);
if (module_enabled("cacher")) {
Modules::$instances["cacher"]->regenerate();
}
}
示例6: delete
/**
* Function: delete
* Deletes the given page.
*
* Calls the @delete_page@ trigger with the <Page> to delete.
*
* Parameters:
* $page_id - The page to delete.
* $recursive - Should the page's children be deleted? (default: false)
*/
static function delete($page_id, $recursive = false)
{
if ($recursive) {
$page = new self($page_id);
foreach ($page->children as $child) {
self::delete($child->id);
}
}
parent::destroy(get_class(), $page_id);
}
示例7: delete
/**
* Function: delete
* Deletes the given topic. Calls the "delete_topic" trigger and passes the <Topic> as an argument.
*
* Parameters:
* $id - The topic to delete.
*/
static function delete($id)
{
$topic = new self($id);
foreach ($topic->message as $message) {
Message::delete($message->id);
}
parent::destroy(get_class(), $id);
foreach ($topic->attachments as $attachment) {
unlink(uploaded($attachment->path, false));
}
if (module_enabled("cacher")) {
Modules::$instances["cacher"]->regenerate();
}
}
示例8: create
public static function create($params)
{
// Check if item is already in the list
if (self::checkRecentItemPresent($params)) {
return array();
}
// Add row to table
$returnArray = parent::create($params);
if (!isset($returnArray) || count($returnArray) < 1) {
return $returnArray;
}
// Check if old row needs to be purged
$itemCount = self::getRecentItemCount($params);
if ($itemCount >= self::$maxItemsPerUser) {
// Get oldest row for user
$id = self::getOldestItem($params);
// Delete oldest row for user
$paramsT = array("data" => array(array("id" => $id)));
parent::destroy($paramsT);
}
return $returnArray;
}
示例9: delete
/**
* Function: delete
* Deletes a given user. Calls the @delete_user@ trigger and passes the <User> as an argument.
*
* Parameters:
* $id - The user to delete.
*/
static function delete($id)
{
parent::destroy(get_class(), $id);
}
示例10: delete
/**
* Function: delete
* Deletes the given extension, including its notes. Calls the "delete_extension" trigger and passes the <Extension> as an argument.
*
* Parameters:
* $id - The extension to delete.
*/
static function delete($id)
{
$extension = new self($id);
foreach ($extension->versions as $version) {
Version::delete($version->id);
}
parent::destroy(get_class(), $id);
if (module_enabled("cacher")) {
Modules::$instances["cacher"]->regenerate();
}
}
示例11: destroy
function destroy()
{
foreach ($this->dsql as $k => $q) {
unset($q);
}
foreach ($this->fields as $k => $f) {
unset($this->fields[$k]);
}
return parent::destroy();
}
示例12: delete
/**
* Function: delete
* Deletes the given version, including its notes. Calls the "delete_version" trigger and passes the <Version> as an argument.
*
* Parameters:
* $id - The version to delete.
*/
static function delete($id)
{
$version = new self($id);
foreach ($version->notes as $note) {
Note::delete($note->id);
}
foreach ($version->attachments as $attachment) {
Attachment::delete($attachment->id);
}
@unlink(uploaded($version->filename, false));
@unlink(uploaded($version->preview, false));
parent::destroy(get_class(), $id);
if (module_enabled("cacher")) {
Modules::$instances["cacher"]->regenerate();
}
}
示例13: delete
/**
* @param $id
*
* @return int
*/
public function delete($id)
{
return $this->model->destroy($id);
}
示例14: delete
/**
* Function: delete
* Deletes the given ticket, including its revisions and attachment. Calls the "delete_ticket" trigger and passes the <Ticket> as an argument.
*
* Parameters:
* $id - The ticket to delete.
*/
static function delete($id)
{
$ticket = new self($id);
foreach ($ticket->revisions as $revision) {
Revision::delete($revision->id);
}
parent::destroy(get_class(), $id);
foreach ($ticket->attachments as $attachment) {
unlink(uploaded($attachment->path, false));
}
if (module_enabled("cacher")) {
Modules::$instances["cacher"]->regenerate();
}
}