Merge branch '3.0'
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / data / comment / ViewableCommentList.class.php
CommitLineData
132f6a11
MW
1<?php
2namespace wcf\data\comment;
9a66ae92 3use wcf\system\cache\runtime\UserProfileRuntimeCache;
132f6a11
MW
4
5/**
6 * Represents a list of decorated comment objects.
7 *
8 * @author Marcel Werk
c839bd49 9 * @copyright 2001-2018 WoltLab GmbH
132f6a11 10 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
e71525e4 11 * @package WoltLabSuite\Core\Data\Comment
e82bf444
MS
12 *
13 * @method ViewableComment current()
81952e86
MS
14 * @method ViewableComment[] getObjects()
15 * @method ViewableComment|null search($objectID)
16 * @property ViewableComment[] $objects
132f6a11
MW
17 */
18class ViewableCommentList extends CommentList {
19 /**
9a66ae92 20 * @inheritDoc
132f6a11 21 */
9a66ae92 22 public $decoratorClassName = ViewableComment::class;
d7f7f6eb 23
9a66ae92
MS
24 /**
25 * @inheritDoc
26 */
3b5fb8ef
MS
27 public function readObjects() {
28 parent::readObjects();
d7f7f6eb 29
3b5fb8ef 30 if (!empty($this->objects)) {
9a66ae92 31 $userIDs = [];
3b5fb8ef
MS
32 foreach ($this->objects as $comment) {
33 if ($comment->userID) {
34 $userIDs[] = $comment->userID;
35 }
36 }
37
38 if (!empty($userIDs)) {
9a66ae92 39 UserProfileRuntimeCache::getInstance()->cacheObjectIDs($userIDs);
3b5fb8ef
MS
40 }
41 }
132f6a11
MW
42 }
43}