/** * @see wcf\system\category\ICategoryType::afterDeletion() */ public function afterDeletion(CategoryEditor $categoryEditor) { // move child categories to parent category foreach (CategoryHandler::getInstance()->getChildCategories($categoryEditor->getDecoratedObject()) as $category) { $__categoryEditor = new CategoryEditor($category); $__categoryEditor->update(array('parentCategoryID' => $categoryEditor->parentCategoryID)); } }
/** * @see wcf\system\category\ICategoryType::afterDeletion() */ public function afterDeletion(CategoryEditor $categoryEditor) { $categoryIDs = array_keys(CategoryHandler::getInstance()->getChildCategories($categoryEditor->getDecoratedObject())); if (!empty($categoryIDs)) { // move child categories to parent category $conditionBuilder = new PreparedStatementConditionBuilder(); $conditionBuilder->add("categoryID IN (?)", array($categoryIDs)); $sql = "UPDATE wcf".WCF_N."_category SET parentCategoryID = ? ".$conditionBuilder; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(array_merge(array($categoryEditor->parentCategoryID), $conditionBuilder->getParameters())); } }