Added removeLabels() method
authorMarcel Werk <burntime@woltlab.com>
Thu, 5 Jun 2014 23:11:26 +0000 (01:11 +0200)
committerMarcel Werk <burntime@woltlab.com>
Thu, 5 Jun 2014 23:11:26 +0000 (01:11 +0200)
wcfsetup/install/files/lib/system/label/LabelHandler.class.php

index 90a186b1da4fd983134eb2a796b1b80c533a8112..63006cc5aa87bc848e9fd64e7462318783b98364 100644 (file)
@@ -336,4 +336,20 @@ class LabelHandler extends SingletonFactory {
                
                return null;
        }
+       
+       /**
+        * Removes all assigned labels for given object ids.
+        *
+        * @param       integer                 $objectTypeID
+        * @param       array<integer>          $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());
+       }
 }