Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
Notification
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
11
100.00% covered (success)
100.00%
1 / 1
 setActivityId
n/a
0 / 0
1
n/a
0 / 0
 getActivityId
n/a
0 / 0
1
n/a
0 / 0
 setGSActorId
n/a
0 / 0
1
n/a
0 / 0
 getGSActorId
n/a
0 / 0
1
n/a
0 / 0
 setReason
n/a
0 / 0
1
n/a
0 / 0
 getReason
n/a
0 / 0
1
n/a
0 / 0
 setCreated
n/a
0 / 0
1
n/a
0 / 0
 getCreated
n/a
0 / 0
1
n/a
0 / 0
 setModified
n/a
0 / 0
1
n/a
0 / 0
 getModified
n/a
0 / 0
1
n/a
0 / 0
 schemaDef
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
1<?php
2
3// {{{ License
4// This file is part of GNU social - https://www.gnu.org/software/social
5//
6// GNU social is free software: you can redistribute it and/or modify
7// it under the terms of the GNU Affero General Public License as published by
8// the Free Software Foundation, either version 3 of the License, or
9// (at your option) any later version.
10//
11// GNU social is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14// GNU Affero General Public License for more details.
15//
16// You should have received a copy of the GNU Affero General Public License
17// along with GNU social.  If not, see <http://www.gnu.org/licenses/>.
18// }}}
19
20namespace App\Entity;
21
22use App\Core\Entity;
23use DateTimeInterface;
24
25/**
26 * Entity for attentions
27 *
28 * @category  DB
29 * @package   GNUsocial
30 *
31 * @author    Zach Copley <zach@status.net>
32 * @copyright 2010 StatusNet Inc.
33 * @author    Mikael Nordfeldth <mmn@hethane.se>
34 * @copyright 2009-2014 Free Software Foundation, Inc http://www.fsf.org
35 * @author    Hugo Sales <hugo@hsal.es>
36 * @copyright 2020-2021 Free Software Foundation, Inc http://www.fsf.org
37 * @license   https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
38 */
39class Notification extends Entity
40{
41    // {{{ Autocode
42    // @codeCoverageIgnoreStart
43    private int $activity_id;
44    private int $gsactor_id;
45    private ?string $reason;
46    private \DateTimeInterface $created;
47    private \DateTimeInterface $modified;
48
49    public function setActivityId(int $activity_id): self
50    {
51        $this->activity_id = $activity_id;
52        return $this;
53    }
54
55    public function getActivityId(): int
56    {
57        return $this->activity_id;
58    }
59
60    public function setGSActorId(int $gsactor_id): self
61    {
62        $this->gsactor_id = $gsactor_id;
63        return $this;
64    }
65
66    public function getGSActorId(): int
67    {
68        return $this->gsactor_id;
69    }
70
71    public function setReason(?string $reason): self
72    {
73        $this->reason = $reason;
74        return $this;
75    }
76
77    public function getReason(): ?string
78    {
79        return $this->reason;
80    }
81
82    public function setCreated(DateTimeInterface $created): self
83    {
84        $this->created = $created;
85        return $this;
86    }
87
88    public function getCreated(): DateTimeInterface
89    {
90        return $this->created;
91    }
92
93    public function setModified(DateTimeInterface $modified): self
94    {
95        $this->modified = $modified;
96        return $this;
97    }
98
99    public function getModified(): DateTimeInterface
100    {
101        return $this->modified;
102    }
103
104    // @codeCoverageIgnoreEnd
105    // }}} Autocode
106
107    public static function schemaDef(): array
108    {
109        return [
110            'name'        => 'notification',
111            'description' => 'Activity notification for gsactors (that are not a mention and not result of a subscription)',
112            'fields'      => [
113                'activity_id' => ['type' => 'int',       'foreign key' => true, 'target' => 'Activity.id', 'multiplicity' => 'one to one', 'not null' => true, 'description' => 'activity_id to give attention'],
114                'gsactor_id'  => ['type' => 'int',       'foreign key' => true, 'target' => 'GSActor.id',  'multiplicity' => 'one to one', 'not null' => true, 'description' => 'gsactor_id for feed receiver'],
115                'reason'      => ['type' => 'varchar',   'length' => 191,       'description' => 'Optional reason why this was brought to the attention of gsactor_id'],
116                'created'     => ['type' => 'datetime',  'not null' => true,    'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
117                'modified'    => ['type' => 'timestamp', 'not null' => true,    'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'],
118            ],
119            'primary key' => ['activity_id', 'gsactor_id'],
120            'indexes'     => [
121                'attention_activity_id_idx' => ['activity_id'],
122                'attention_gsactor_id_idx'  => ['gsactor_id'],
123            ],
124        ];
125    }
126}