| 1 | <?php |
| 2 | |
| 3 | namespace wcf\data\conversation; |
| 4 | |
| 5 | use wcf\system\WCF; |
| 6 | |
| 7 | /** |
| 8 | * Represents a list of conversations for RSS feeds. |
| 9 | * |
| 10 | * @author Alexander Ebert |
| 11 | * @copyright 2001-2019 WoltLab GmbH |
| 12 | * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> |
| 13 | * @package WoltLabSuite\Core\Data\Conversation |
| 14 | * |
| 15 | * @method FeedConversation current() |
| 16 | * @method FeedConversation[] getObjects() |
| 17 | * @method FeedConversation|null getSingleObject() |
| 18 | * @method FeedConversation|null search($objectID) |
| 19 | * @property FeedConversation[] $objects |
| 20 | */ |
| 21 | class FeedConversationList extends ConversationList |
| 22 | { |
| 23 | /** |
| 24 | * @inheritDoc |
| 25 | */ |
| 26 | public $decoratorClassName = FeedConversation::class; |
| 27 | |
| 28 | /** |
| 29 | * @inheritDoc |
| 30 | */ |
| 31 | public $sqlOrderBy = 'conversation.lastPostTime DESC'; |
| 32 | |
| 33 | /** |
| 34 | * @inheritDoc |
| 35 | */ |
| 36 | public function readObjectIDs() |
| 37 | { |
| 38 | $sql = "SELECT conversation_to_user.conversationID AS objectID |
| 39 | FROM wcf" . WCF_N . "_conversation_to_user conversation_to_user |
| 40 | " . $this->sqlConditionJoins . " |
| 41 | " . $this->getConditionBuilder() . " |
| 42 | " . (!empty($this->sqlOrderBy) ? "ORDER BY " . $this->sqlOrderBy : ''); |
| 43 | $statement = WCF::getDB()->prepareStatement($sql, $this->sqlLimit, $this->sqlOffset); |
| 44 | $statement->execute($this->getConditionBuilder()->getParameters()); |
| 45 | $this->objectIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * @inheritDoc |
| 50 | */ |
| 51 | public function readObjects() |
| 52 | { |
| 53 | if ($this->objectIDs === null) { |
| 54 | $this->readObjectIDs(); |
| 55 | } |
| 56 | |
| 57 | parent::readObjects(); |
| 58 | } |
| 59 | } |