]> git.mxchange.org Git - friendica.git/blob - src/Navigation/Notifications/Entity/Notification.php
API: Set "dismissed" instead of "seen"
[friendica.git] / src / Navigation / Notifications / Entity / Notification.php
1 <?php
2
3 namespace Friendica\Navigation\Notifications\Entity;
4
5 use DateTime;
6 use Friendica\BaseEntity;
7
8 /**
9  * @property-read $id
10  * @property-read $uid
11  * @property-read $verb
12  * @property-read $type
13  * @property-read $actorId
14  * @property-read $targetUriId
15  * @property-read $parentUriId
16  * @property-read $created
17  * @property-read $seen
18  */
19 class Notification extends BaseEntity
20 {
21         /** @var int */
22         protected $id;
23         /** @var int */
24         protected $uid;
25         /** @var string */
26         protected $verb;
27         /**
28          * @var int One of the \Friendica\Model\Post\UserNotification::TYPE_* constant values
29          * @see \Friendica\Model\Post\UserNotification
30          */
31         protected $type;
32         /** @var int */
33         protected $actorId;
34         /** @var int */
35         protected $targetUriId;
36         /** @var int */
37         protected $parentUriId;
38         /** @var DateTime */
39         protected $created;
40         /** @var bool */
41         protected $seen;
42         /** @var bool */
43         protected $dismissed;
44
45         /**
46          * Please do not use this constructor directly, instead use one of the method of the Notification factory.
47          *
48          * @param int           $uid
49          * @param string        $verb
50          * @param int           $type
51          * @param int           $actorId
52          * @param int|null      $targetUriId
53          * @param int|null      $parentUriId
54          * @param DateTime|null $created
55          * @param bool          $seen
56          * @param int|null      $id
57          * @param bool          $dismissed
58          * @see \Friendica\Navigation\Notifications\Factory\Notification
59          */
60         public function __construct(int $uid, string $verb, int $type, int $actorId, int $targetUriId = null, int $parentUriId = null, DateTime $created = null, bool $seen = false, int $id = null, bool $dismissed = false)
61         {
62                 $this->uid         = $uid;
63                 $this->verb        = $verb;
64                 $this->type        = $type;
65                 $this->actorId     = $actorId;
66                 $this->targetUriId = $targetUriId;
67                 $this->parentUriId = $parentUriId ?: $targetUriId;
68                 $this->created     = $created;
69                 $this->seen        = $seen;
70                 $this->id          = $id;
71                 $this->dismissed   = $dismissed;
72         }
73
74         public function setSeen()
75         {
76                 $this->seen = true;
77         }
78
79         public function setDismissed()
80         {
81                 $this->dismissed = true;
82         }
83 }