2 declare(strict_types=1);
3 namespace wcf\system\user\notification\object\type;
4 use wcf\data\object\type\AbstractObjectTypeProcessor;
5 use wcf\data\DatabaseObjectList;
8 * Provides a default implementation of IUserNotificationObjectType.
11 * @copyright 2001-2018 WoltLab GmbH
12 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
13 * @package WoltLabSuite\Core\System\User\Notification\Object\Type
15 class AbstractUserNotificationObjectType extends AbstractObjectTypeProcessor implements IUserNotificationObjectType {
17 * class name of the object decorator
20 protected static $decoratorClassName = '';
26 protected static $objectClassName = '';
29 * class name for DatabaseObjectList
32 protected static $objectListClassName = '';
37 public function getObjectsByIDs(array $objectIDs) {
38 $indexName = call_user_func([static::$objectClassName, 'getDatabaseTableIndexName']);
40 /** @var DatabaseObjectList $objectList */
41 $objectList = new static::$objectListClassName();
42 $objectList->setObjectIDs($objectIDs);
43 $objectList->sqlLimit = 0;
44 $objectList->decoratorClassName = static::$decoratorClassName;
45 $objectList->readObjects();
46 $objects = $objectList->getObjects();
48 foreach ($objectIDs as $objectID) {
49 // append empty objects for unknown ids
50 if (!isset($objects[$objectID])) {
51 // '__unknownNotificationObject' tells the notification API
52 // that the object does not exist anymore so that the related
53 // notification can be deleted automatically
54 $objects[$objectID] = new static::$decoratorClassName(new static::$objectClassName(null, [
55 '__unknownNotificationObject' => true,
56 $indexName => $objectID