From 3cd5d2b96225122ebf44758ffbe748b8c5faf1eb Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sun, 24 May 2015 12:12:47 +0200 Subject: [PATCH] Use DatabaseObjectList::setObjects() wherever possible --- wcfsetup/install/files/lib/data/ad/AdAction.class.php | 2 +- .../files/lib/data/attachment/AttachmentAction.class.php | 2 +- .../lib/data/comment/LikeableCommentProvider.class.php | 2 +- .../files/lib/data/comment/StructuredCommentList.class.php | 2 +- .../data/comment/response/CommentResponseAction.class.php | 2 +- .../install/files/lib/data/notice/NoticeAction.class.php | 2 +- wcfsetup/install/files/lib/data/user/User.class.php | 2 +- .../comment/manager/UserProfileCommentManager.class.php | 4 ++-- .../CommentCommentModerationQueueReportHandler.class.php | 2 +- .../CommentResponseModerationQueueReportHandler.class.php | 4 ++-- .../install/files/lib/system/poll/PollManager.class.php | 2 +- .../user/activity/event/FollowUserActivityEvent.class.php | 2 +- .../event/ProfileCommentResponseUserActivityEvent.class.php | 6 +++--- .../event/ProfileCommentUserActivityEvent.class.php | 4 ++-- .../group/assignment/UserGroupAssignmentHandler.class.php | 2 +- .../lib/system/user/online/location/UserLocation.class.php | 2 +- 16 files changed, 21 insertions(+), 21 deletions(-) diff --git a/wcfsetup/install/files/lib/data/ad/AdAction.class.php b/wcfsetup/install/files/lib/data/ad/AdAction.class.php index 512eaf1956..0f33a5158a 100644 --- a/wcfsetup/install/files/lib/data/ad/AdAction.class.php +++ b/wcfsetup/install/files/lib/data/ad/AdAction.class.php @@ -88,7 +88,7 @@ class AdAction extends AbstractDatabaseObjectAction implements ISortableAction, } $adList = new AdList(); - $adList->getConditionBuilder()->add('ad.adID IN (?)', array($this->parameters['data']['structure'][0])); + $adList->setObjectIDs($this->parameters['data']['structure'][0]); if ($adList->countObjects() != count($this->parameters['data']['structure'][0])) { throw new UserInputException('structure'); } diff --git a/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php b/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php index 7e0c53160e..03fbebf933 100644 --- a/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php +++ b/wcfsetup/install/files/lib/data/attachment/AttachmentAction.class.php @@ -261,7 +261,7 @@ class AttachmentAction extends AbstractDatabaseObjectAction { // get attachments from database (check thumbnail status) $attachmentList = new AttachmentList(); - $attachmentList->getConditionBuilder()->add('attachment.attachmentID IN (?)', array($attachmentIDs)); + $attachmentList->setObjectIDs($attachmentIDs); $attachmentList->readObjects(); foreach ($attachmentList as $attachment) { diff --git a/wcfsetup/install/files/lib/data/comment/LikeableCommentProvider.class.php b/wcfsetup/install/files/lib/data/comment/LikeableCommentProvider.class.php index de9207520d..000b678be0 100644 --- a/wcfsetup/install/files/lib/data/comment/LikeableCommentProvider.class.php +++ b/wcfsetup/install/files/lib/data/comment/LikeableCommentProvider.class.php @@ -53,7 +53,7 @@ class LikeableCommentProvider extends AbstractObjectTypeProvider implements ILik // fetch comments $commentList = new CommentList(); - $commentList->getConditionBuilder()->add("comment.commentID IN (?)", array($commentIDs)); + $commentList->setObjectIDs($commentIDs); $commentList->readObjects(); $comments = $commentList->getObjects(); diff --git a/wcfsetup/install/files/lib/data/comment/StructuredCommentList.class.php b/wcfsetup/install/files/lib/data/comment/StructuredCommentList.class.php index 09afb061eb..e4c2b826f0 100644 --- a/wcfsetup/install/files/lib/data/comment/StructuredCommentList.class.php +++ b/wcfsetup/install/files/lib/data/comment/StructuredCommentList.class.php @@ -105,7 +105,7 @@ class StructuredCommentList extends CommentList { // fetch last responses if (!empty($responseIDs)) { $responseList = new CommentResponseList(); - $responseList->getConditionBuilder()->add("comment_response.responseID IN (?)", array(array_keys($responseIDs))); + $responseList->setObjectIDs(array_keys($responseIDs)); $responseList->readObjects(); foreach ($responseList as $response) { diff --git a/wcfsetup/install/files/lib/data/comment/response/CommentResponseAction.class.php b/wcfsetup/install/files/lib/data/comment/response/CommentResponseAction.class.php index d71359f2a8..9fa7ccd7dc 100644 --- a/wcfsetup/install/files/lib/data/comment/response/CommentResponseAction.class.php +++ b/wcfsetup/install/files/lib/data/comment/response/CommentResponseAction.class.php @@ -66,7 +66,7 @@ class CommentResponseAction extends AbstractDatabaseObjectAction { } $commentList = new CommentList(); - $commentList->getConditionBuilder()->add("comment.commentID IN (?)", array($commentIDs)); + $commentList->setObjectIDs($commentIDs); $commentList->readObjects(); $comments = $commentList->getObjects(); diff --git a/wcfsetup/install/files/lib/data/notice/NoticeAction.class.php b/wcfsetup/install/files/lib/data/notice/NoticeAction.class.php index 165ca3a3bc..dd81cf8617 100644 --- a/wcfsetup/install/files/lib/data/notice/NoticeAction.class.php +++ b/wcfsetup/install/files/lib/data/notice/NoticeAction.class.php @@ -139,7 +139,7 @@ class NoticeAction extends AbstractDatabaseObjectAction implements ISortableActi } $noticeList = new NoticeList(); - $noticeList->getConditionBuilder()->add('notice.noticeID IN (?)', array($this->parameters['data']['structure'][0])); + $noticeList->setObjectIDs($this->parameters['data']['structure'][0]); if ($noticeList->countObjects() != count($this->parameters['data']['structure'][0])) { throw new UserInputException('structure'); } diff --git a/wcfsetup/install/files/lib/data/user/User.class.php b/wcfsetup/install/files/lib/data/user/User.class.php index d06f1fe2ed..59fca7298e 100644 --- a/wcfsetup/install/files/lib/data/user/User.class.php +++ b/wcfsetup/install/files/lib/data/user/User.class.php @@ -355,7 +355,7 @@ final class User extends DatabaseObject implements IRouteController, IUserConten */ public static function getUsers(array $userIDs) { $userList = new UserList(); - $userList->getConditionBuilder()->add("user_table.userID IN (?)", array($userIDs)); + $userList->setObjectIDs($userIDs); $userList->readObjects(); return $userList->getObjects(); diff --git a/wcfsetup/install/files/lib/system/comment/manager/UserProfileCommentManager.class.php b/wcfsetup/install/files/lib/system/comment/manager/UserProfileCommentManager.class.php index 25ea761ed7..54910c7617 100644 --- a/wcfsetup/install/files/lib/system/comment/manager/UserProfileCommentManager.class.php +++ b/wcfsetup/install/files/lib/system/comment/manager/UserProfileCommentManager.class.php @@ -149,7 +149,7 @@ class UserProfileCommentManager extends AbstractCommentManager implements IViewa $userIDs = $responses = array(); if (!empty($responseIDs)) { $responseList = new CommentResponseList(); - $responseList->getConditionBuilder()->add("comment_response.responseID IN (?)", array($responseIDs)); + $responseList->setObjectIDs($responseIDs); $responseList->readObjects(); $responses = $responseList->getObjects(); @@ -163,7 +163,7 @@ class UserProfileCommentManager extends AbstractCommentManager implements IViewa // fetch comments $commentList = new CommentList(); - $commentList->getConditionBuilder()->add("comment.commentID IN (?)", array($commentIDs)); + $commentList->setObjectIDs($commentIDs); $commentList->readObjects(); $comments = $commentList->getObjects(); diff --git a/wcfsetup/install/files/lib/system/moderation/queue/report/CommentCommentModerationQueueReportHandler.class.php b/wcfsetup/install/files/lib/system/moderation/queue/report/CommentCommentModerationQueueReportHandler.class.php index 364990a16e..dd6138204a 100644 --- a/wcfsetup/install/files/lib/system/moderation/queue/report/CommentCommentModerationQueueReportHandler.class.php +++ b/wcfsetup/install/files/lib/system/moderation/queue/report/CommentCommentModerationQueueReportHandler.class.php @@ -190,7 +190,7 @@ class CommentCommentModerationQueueReportHandler extends AbstractModerationQueue // fetch comments $commentList = new CommentList(); - $commentList->getConditionBuilder()->add("comment.commentID IN (?)", array($objectIDs)); + $commentList->setObjectIDs($objectIDs); $commentList->readObjects(); $comments = $commentList->getObjects(); diff --git a/wcfsetup/install/files/lib/system/moderation/queue/report/CommentResponseModerationQueueReportHandler.class.php b/wcfsetup/install/files/lib/system/moderation/queue/report/CommentResponseModerationQueueReportHandler.class.php index 64de213ac3..af4e75a645 100644 --- a/wcfsetup/install/files/lib/system/moderation/queue/report/CommentResponseModerationQueueReportHandler.class.php +++ b/wcfsetup/install/files/lib/system/moderation/queue/report/CommentResponseModerationQueueReportHandler.class.php @@ -169,7 +169,7 @@ class CommentResponseModerationQueueReportHandler extends CommentCommentModerati // fetch responses $responseList = new CommentResponseList(); - $responseList->getConditionBuilder()->add("comment_response.responseID IN (?)", array($objectIDs)); + $responseList->setObjectIDs($objectIDs); $responseList->readObjects(); $responses = $responseList->getObjects(); @@ -181,7 +181,7 @@ class CommentResponseModerationQueueReportHandler extends CommentCommentModerati if (!empty($commentIDs)) { $commentList = new CommentList(); - $commentList->getConditionBuilder()->add("comment.commentID IN (?)", array($commentIDs)); + $commentList->setObjectIDs($commentIDs); $commentList->readObjects(); $comments = $commentList->getObjects(); } diff --git a/wcfsetup/install/files/lib/system/poll/PollManager.class.php b/wcfsetup/install/files/lib/system/poll/PollManager.class.php index dd7898374c..d8ef0ee515 100644 --- a/wcfsetup/install/files/lib/system/poll/PollManager.class.php +++ b/wcfsetup/install/files/lib/system/poll/PollManager.class.php @@ -327,7 +327,7 @@ class PollManager extends SingletonFactory { */ public function getPolls(array $pollIDs) { $pollList = new PollList(); - $pollList->getConditionBuilder()->add("poll.pollID IN (?)", array($pollIDs)); + $pollList->setObjectIDs($pollIDs); $pollList->readObjects(); $polls = $pollList->getObjects(); diff --git a/wcfsetup/install/files/lib/system/user/activity/event/FollowUserActivityEvent.class.php b/wcfsetup/install/files/lib/system/user/activity/event/FollowUserActivityEvent.class.php index 47aebc89d9..9b30d3a074 100644 --- a/wcfsetup/install/files/lib/system/user/activity/event/FollowUserActivityEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/activity/event/FollowUserActivityEvent.class.php @@ -26,7 +26,7 @@ class FollowUserActivityEvent extends SingletonFactory implements IUserActivityE // fetch user id and username $userList = new UserList(); - $userList->getConditionBuilder()->add("user_table.userID IN (?)", array($objectIDs)); + $userList->setObjectIDs($objectIDs); $userList->readObjects(); $users = $userList->getObjects(); diff --git a/wcfsetup/install/files/lib/system/user/activity/event/ProfileCommentResponseUserActivityEvent.class.php b/wcfsetup/install/files/lib/system/user/activity/event/ProfileCommentResponseUserActivityEvent.class.php index 460134eeff..a9a58be223 100644 --- a/wcfsetup/install/files/lib/system/user/activity/event/ProfileCommentResponseUserActivityEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/activity/event/ProfileCommentResponseUserActivityEvent.class.php @@ -33,7 +33,7 @@ class ProfileCommentResponseUserActivityEvent extends SingletonFactory implement // fetch responses $responseList = new CommentResponseList(); - $responseList->getConditionBuilder()->add("comment_response.responseID IN (?)", array($responseIDs)); + $responseList->setObjectIDs($responseIDs); $responseList->readObjects(); $responses = $responseList->getObjects(); @@ -44,7 +44,7 @@ class ProfileCommentResponseUserActivityEvent extends SingletonFactory implement } if (!empty($commentIDs)) { $commentList = new CommentList(); - $commentList->getConditionBuilder()->add("comment.commentID IN (?)", array($commentIDs)); + $commentList->setObjectIDs($commentIDs); $commentList->readObjects(); $comments = $commentList->getObjects(); } @@ -57,7 +57,7 @@ class ProfileCommentResponseUserActivityEvent extends SingletonFactory implement } if (!empty($userIDs)) { $userList = new UserProfileList(); - $userList->getConditionBuilder()->add("user_table.userID IN (?)", array($userIDs)); + $userList->setObjectIDs($userIDs); $userList->readObjects(); $users = $userList->getObjects(); } diff --git a/wcfsetup/install/files/lib/system/user/activity/event/ProfileCommentUserActivityEvent.class.php b/wcfsetup/install/files/lib/system/user/activity/event/ProfileCommentUserActivityEvent.class.php index 2dfabb8572..068e439a2b 100644 --- a/wcfsetup/install/files/lib/system/user/activity/event/ProfileCommentUserActivityEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/activity/event/ProfileCommentUserActivityEvent.class.php @@ -32,7 +32,7 @@ class ProfileCommentUserActivityEvent extends SingletonFactory implements IUserA // fetch comments $commentList = new CommentList(); - $commentList->getConditionBuilder()->add("comment.commentID IN (?)", array($commentIDs)); + $commentList->setObjectIDs($commentIDs); $commentList->readObjects(); $comments = $commentList->getObjects(); @@ -43,7 +43,7 @@ class ProfileCommentUserActivityEvent extends SingletonFactory implements IUserA } if (!empty($userIDs)) { $userList = new UserProfileList(); - $userList->getConditionBuilder()->add("user_table.userID IN (?)", array($userIDs)); + $userList->setObjectIDs($userIDs); $userList->readObjects(); $users = $userList->getObjects(); } diff --git a/wcfsetup/install/files/lib/system/user/group/assignment/UserGroupAssignmentHandler.class.php b/wcfsetup/install/files/lib/system/user/group/assignment/UserGroupAssignmentHandler.class.php index e1754463f0..595c560adb 100644 --- a/wcfsetup/install/files/lib/system/user/group/assignment/UserGroupAssignmentHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/group/assignment/UserGroupAssignmentHandler.class.php @@ -37,7 +37,7 @@ class UserGroupAssignmentHandler extends SingletonFactory { if (empty($userIDs)) return; $userList = new UserList(); - $userList->getConditionBuilder()->add('user_table.userID IN (?)', array($userIDs)); + $userList->setObjectIDs($userIDs); $userList->readObjects(); $assignments = UserGroupAssignmentCacheBuilder::getInstance()->getData(); diff --git a/wcfsetup/install/files/lib/system/user/online/location/UserLocation.class.php b/wcfsetup/install/files/lib/system/user/online/location/UserLocation.class.php index 06e8027b34..9744b8bb23 100644 --- a/wcfsetup/install/files/lib/system/user/online/location/UserLocation.class.php +++ b/wcfsetup/install/files/lib/system/user/online/location/UserLocation.class.php @@ -59,7 +59,7 @@ class UserLocation implements IUserOnlineLocation { $this->userIDs = array_unique($this->userIDs); $userList = new UserList(); - $userList->getConditionBuilder()->add('user_table.userID IN (?)', array($this->userIDs)); + $userList->setObjectIDs($this->userIDs); $userList->readObjects(); $this->users = $userList->getObjects(); } -- 2.20.1