From 789915e4ccb19f1932d8f9d74616710d6320049e Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Fri, 6 Jun 2014 01:11:26 +0200 Subject: [PATCH] Added removeLabels() method --- .../lib/system/label/LabelHandler.class.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/wcfsetup/install/files/lib/system/label/LabelHandler.class.php b/wcfsetup/install/files/lib/system/label/LabelHandler.class.php index 90a186b1da..63006cc5aa 100644 --- a/wcfsetup/install/files/lib/system/label/LabelHandler.class.php +++ b/wcfsetup/install/files/lib/system/label/LabelHandler.class.php @@ -336,4 +336,20 @@ class LabelHandler extends SingletonFactory { return null; } + + /** + * Removes all assigned labels for given object ids. + * + * @param integer $objectTypeID + * @param array $objectID + */ + public function removeLabels($objectTypeID, array $objectIDs) { + $conditions = new PreparedStatementConditionBuilder(); + $conditions->add("objectTypeID = ?", array($objectTypeID)); + $conditions->add("objectID IN (?)", array($objectIDs)); + $sql = "DELETE FROM wcf".WCF_N."_label_object + ".$conditions; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute($conditions->getParameters()); + } } -- 2.20.1