forked from ezsystems/ezpublish-spi
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Merge remote-tracking branch 'upstream/master'
- Loading branch information
Showing
8 changed files
with
188 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace eZ\Publish\SPI\Notification\Renderer; | ||
|
||
use eZ\Publish\API\Repository\Values\Notification\Notification; | ||
|
||
interface NotificationRenderer | ||
{ | ||
/** | ||
* @param \eZ\Publish\API\Repository\Values\Notification\Notification $notification | ||
* | ||
* @return string | ||
*/ | ||
public function render(Notification $notification): string; | ||
|
||
/** | ||
* @param \eZ\Publish\API\Repository\Values\Notification\Notification $notification | ||
* | ||
* @return string|null | ||
*/ | ||
public function generateUrl(Notification $notification): ?string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace eZ\Publish\SPI\Persistence\Notification; | ||
|
||
use eZ\Publish\SPI\Persistence\ValueObject; | ||
|
||
class CreateStruct extends ValueObject | ||
{ | ||
/** @var int $ownerId */ | ||
public $ownerId; | ||
|
||
/** @var string $type */ | ||
public $type; | ||
|
||
/** @var bool $isPending */ | ||
public $isPending; | ||
|
||
/** @var array $data */ | ||
public $data = []; | ||
|
||
/** @var int $created */ | ||
public $created; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace eZ\Publish\SPI\Persistence\Notification; | ||
|
||
use eZ\Publish\API\Repository\Values\Notification\Notification as APINotification; | ||
|
||
interface Handler | ||
{ | ||
/** | ||
* Store Notification ValueObject in persistent storage. | ||
* | ||
* @param \eZ\Publish\SPI\Persistence\Notification\CreateStruct $createStruct | ||
* | ||
* @return \eZ\Publish\SPI\Persistence\Notification\Notification | ||
*/ | ||
public function createNotification(CreateStruct $createStruct): Notification; | ||
|
||
/** | ||
* Update Notification ValueObject in persistent storage. | ||
* There's no edit feature but it's essential to mark Notification as read. | ||
* | ||
* @param \eZ\Publish\API\Repository\Values\Notification\Notification $notification | ||
* @param \eZ\Publish\SPI\Persistence\Notification\UpdateStruct $updateStruct | ||
* | ||
* @return \eZ\Publish\SPI\Persistence\Notification\Notification | ||
*/ | ||
public function updateNotification(APINotification $notification, UpdateStruct $updateStruct): Notification; | ||
|
||
/** | ||
* Count users unread Notifications. | ||
* | ||
* @param int $ownerId | ||
* | ||
* @return int | ||
*/ | ||
public function countPendingNotifications(int $ownerId): int; | ||
|
||
/** | ||
* Get Notification by its id. | ||
* | ||
* @param int $notificationId | ||
* | ||
* @return \eZ\Publish\SPI\Persistence\Notification\Notification | ||
*/ | ||
public function getNotificationById(int $notificationId): Notification; | ||
|
||
/** | ||
* @param int $userId | ||
* @param int $offset | ||
* @param int $limit | ||
* | ||
* @return \eZ\Publish\SPI\Persistence\Notification\Notification[] | ||
*/ | ||
public function loadUserNotifications(int $userId, int $offset, int $limit): array; | ||
|
||
/** | ||
* @param int $currentUserId | ||
* | ||
* @return int | ||
*/ | ||
public function countNotifications(int $currentUserId): int; | ||
|
||
/** | ||
* @param \eZ\Publish\API\Repository\Values\Notification\Notification $notification | ||
*/ | ||
public function delete(APINotification $notification): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace eZ\Publish\SPI\Persistence\Notification; | ||
|
||
use eZ\Publish\SPI\Persistence\ValueObject; | ||
|
||
class Notification extends ValueObject | ||
{ | ||
/** @var int $id */ | ||
public $id; | ||
|
||
/** @var int $ownerId */ | ||
public $ownerId; | ||
|
||
/** @var bool $isPending */ | ||
public $isPending; | ||
|
||
/** @var string $type */ | ||
public $type; | ||
|
||
/** @var int $created */ | ||
public $created; | ||
|
||
/** @var array $data */ | ||
public $data = []; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace eZ\Publish\SPI\Persistence\Notification; | ||
|
||
use eZ\Publish\SPI\Persistence\ValueObject; | ||
|
||
class UpdateStruct extends ValueObject | ||
{ | ||
/** @var bool $isPending */ | ||
public $isPending; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters