2 namespace wcf\system\user\notification\object\type;
3 use wcf\data\object\type\AbstractObjectTypeProcessor;
4 use wcf\data\DatabaseObjectList;
7 * Provides a default implementation of IUserNotificationObjectType.
10 * @copyright 2001-2018 WoltLab GmbH
11 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
12 * @package WoltLabSuite\Core\System\User\Notification\Object\Type
14 class AbstractUserNotificationObjectType extends AbstractObjectTypeProcessor implements IUserNotificationObjectType {
16 * class name of the object decorator
19 protected static $decoratorClassName = '';
25 protected static $objectClassName = '';
28 * class name for DatabaseObjectList
31 protected static $objectListClassName = '';
36 public function getObjectsByIDs(array $objectIDs) {
37 $indexName = call_user_func([static::$objectClassName, 'getDatabaseTableIndexName']);
39 /** @var DatabaseObjectList $objectList */
40 $objectList = new static::$objectListClassName();
41 $objectList->setObjectIDs($objectIDs);
42 $objectList->sqlLimit = 0;
43 $objectList->decoratorClassName = static::$decoratorClassName;
44 $objectList->readObjects();
45 $objects = $objectList->getObjects();
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