NotificationCollection example

$criteria->setLimit($limit);

        $notifications = $context->scope(Context::SYSTEM_SCOPE, function DContext $context) use ($criteria) {
            /** @var NotificationCollection $notifications */
            $notifications = $this->notificationRepository->search($criteria$context)->getEntities();

            return $notifications;
        });

        if ($notifications->count() === 0) {
            return [
                'notifications' => new NotificationCollection(),
                'timestamp' => null,
            ];
        }

        /** @var NotificationEntity $notification */
        $notification = $notifications->last();

        /** @var \DateTimeInterface $latestTimestamp */
        $latestTimestamp = $notification->getCreatedAt();
        $latestTimestamp = $latestTimestamp->format(Defaults::STORAGE_DATE_TIME_FORMAT);

        
Home | Imprint | This part of the site doesn't use cookies.