From: Marcel Werk Date: Thu, 5 Jun 2014 23:11:26 +0000 (+0200) Subject: Added removeLabels() method X-Git-Tag: 2.1.0_Alpha_1~749 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=789915e4ccb19f1932d8f9d74616710d6320049e;p=GitHub%2FWoltLab%2FWCF.git Added removeLabels() method --- 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()); + } }