Delete a page extra by its id
public static deleteExtraById ( integer $id, boolean $deleteBlock = false ) | ||
$id | integer | The id of the extra to delete. |
$deleteBlock | boolean | Should the block be deleted? Default is false. |
/** * Delete a certain user * * @param int $id */ public static function delete($id) { $record = self::get($id); // delete extra BackendModel::deleteExtraById($record['extra_id'], true); // delete user id BackendModel::get('database')->delete('instagram_users', 'id = ?', (int) $id); }
/** * Delete an item * * @param int $id The id of the record to delete. */ public static function delete($id) { // get db $db = BackendModel::getContainer()->get('database'); // get item $item = self::get($id); BackendModel::deleteExtraById($item['extra_id']); // delete location and its settings $db->delete('location', 'id = ? AND language = ?', array((int) $id, BL::getWorkingLanguage())); $db->delete('location_settings', 'map_id = ?', array((int) $id)); }
/** * Delete a specific category * * @param int $id */ public static function deleteCategory($id) { $db = BackendModel::getContainer()->get('database'); $item = self::getCategory($id); if (!empty($item)) { $db->delete('meta', 'id = ?', array($item['meta_id'])); $db->delete('faq_categories', 'id = ?', array((int) $id)); $db->update('faq_questions', array('category_id' => null), 'category_id = ?', array((int) $id)); BackendModel::deleteExtraById($item['extra_id']); } }
/** * Delete an item. * * @param int $id The id of the record to delete. */ public static function delete($id) { // recast id $id = (int) $id; // get item $item = self::get($id); // delete extra and pages_blocks BackendModel::deleteExtraById($item['extra_id']); // delete the content_block BackendModel::getContainer()->get('database')->delete('content_blocks', 'id = ? AND language = ?', array($id, BL::getWorkingLanguage())); }
/** * Delete a specific category * * @param int $id */ public static function deleteCategory($id) { $db = BackendModel::getContainer()->get('database'); $item = self::getCategory($id); if (!empty($item)) { $db->delete('meta', 'id = ?', array($item['meta_id'])); $db->delete('catalog_categories', 'id = ?', array((int) $id)); $db->delete('catalog_categories_lang', 'id = ?', array((int) $id)); $db->update('catalog_products', array('category_id' => null), 'category_id = ?', array((int) $id)); // delete extra and pages_blocks BackendModel::deleteExtraById($item['extra_id']); } }
/** * Delete an item. * * @param int $id The id of the record to delete. * * @deprecated use doctrine instead */ public static function delete($id) { trigger_error('Backend\\Modules\\ContentBlocks\\Engine is deprecated. Switch to doctrine instead.', E_USER_DEPRECATED); // recast id $id = (int) $id; // get item $item = self::get($id); // delete extra and pages_blocks BackendModel::deleteExtraById($item['extra_id']); // delete the content_block BackendModel::getContainer()->get('database')->delete('content_blocks', 'id = ? AND language = ?', [$id, BL::getWorkingLanguage()]); }
/** * @param DeleteContentBlock $deleteContentBlock * * @return ContentBlock */ public function handle(DeleteContentBlock $deleteContentBlock) { $this->contentBlockRepository->removeByIdAndLocale($deleteContentBlock->contentBlock->getId(), $deleteContentBlock->contentBlock->getLocale()); Model::deleteExtraById($deleteContentBlock->contentBlock->getExtraId()); }