fcd221d607409c1e9282a97335110d0e4922c7a4
[GitHub/WoltLab/WCF.git] /
1 <?php
2 namespace wcf\system\user\notification\object\type;
3 use wcf\data\object\type\AbstractObjectTypeProcessor;
4
5 /**
6 * Provides a default implementation of IUserNotificationObjectType.
7 *
8 * @author Marcel Werk
9 * @copyright 2001-2015 WoltLab GmbH
10 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
11 * @package com.woltlab.wcf
12 * @subpackage system.user.notification.object.type
13 * @category Community Framework
14 */
15 class AbstractUserNotificationObjectType extends AbstractObjectTypeProcessor implements IUserNotificationObjectType {
16 /**
17 * class name of the object decorator
18 * @var string
19 */
20 protected static $decoratorClassName = '';
21
22 /**
23 * object class name
24 * @var string
25 */
26 protected static $objectClassName = '';
27
28 /**
29 * class name for DatabaseObjectList
30 * @var string
31 */
32 protected static $objectListClassName = '';
33
34 /**
35 * @see \wcf\system\user\notification\object\type\IUserNotificationObjectType::getObjectsByIDs()
36 */
37 public function getObjectsByIDs(array $objectIDs) {
38 $indexName = call_user_func([static::$objectClassName, 'getDatabaseTableIndexName']);
39
40 $objectList = new static::$objectListClassName();
41 $objectList->setObjectIDs($objectIDs);
42 $objectList->sqLimit = 0;
43 $objectList->decoratorClassName = static::$decoratorClassName;
44 $objectList->readObjects();
45 $objects = $objectList->getObjects();
46
47 foreach ($objectIDs as $objectID) {
48 // append empty objects for unknown ids
49 if (!isset($objects[$objectID])) {
50 // '__unknownNotificationObject' tells the notification API
51 // that the object does not exist anymore so that the related
52 // notification can be deleted automatically
53 $objects[$objectID] = new static::$decoratorClassName(new static::$objectClassName(null, [
54 '__unknownNotificationObject' => true,
55 $indexName => $objectID
56 ]));
57 }
58 }
59
60 return $objects;
61 }
62 }