Fixes DatabaseObjectEditor::deleteAll() return value
authorMatthias Schmidt <gravatronics@live.com>
Wed, 21 Mar 2012 12:50:11 +0000 (13:50 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Wed, 21 Mar 2012 12:50:11 +0000 (13:50 +0100)
This way the number of deleted objects is returned and not the number of given object ids.

wcfsetup/install/files/lib/data/DatabaseObjectEditor.class.php

index 7aa1d1b59f3cb17144b269eceae35b40fc7e9868..fb5bce8d15c12bd5c3f58cce8abfa92c7db141df 100644 (file)
@@ -106,12 +106,14 @@ abstract class DatabaseObjectEditor extends DatabaseObjectDecorator implements I
                        WHERE           ".static::getDatabaseTableIndexName()." = ?";
                $statement = WCF::getDB()->prepareStatement($sql);
                
+               $affectedCount = 0;
                WCF::getDB()->beginTransaction();
                foreach ($objectIDs as $objectID) {
                        $statement->executeUnbuffered(array($objectID));
+                       $affectedCount += $statement->getAffectedRows();
                }
                WCF::getDB()->commitTransaction();
                
-               return count($objectIDs);
+               return $affectedCount;
        }
 }