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
GroupInbox
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
7
100.00% covered (success)
100.00%
1 / 1
 setGroupId
n/a
0 / 0
1
n/a
0 / 0
 getGroupId
n/a
0 / 0
1
n/a
0 / 0
 setActivityId
n/a
0 / 0
1
n/a
0 / 0
 getActivityId
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
 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 Group's inbox
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 GroupInbox extends Entity
40{
41    // {{{ Autocode
42    // @codeCoverageIgnoreStart
43    private int $group_id;
44    private int $activity_id;
45    private \DateTimeInterface $created;
46
47    public function setGroupId(int $group_id): self
48    {
49        $this->group_id = $group_id;
50        return $this;
51    }
52
53    public function getGroupId(): int
54    {
55        return $this->group_id;
56    }
57
58    public function setActivityId(int $activity_id): self
59    {
60        $this->activity_id = $activity_id;
61        return $this;
62    }
63
64    public function getActivityId(): int
65    {
66        return $this->activity_id;
67    }
68
69    public function setCreated(DateTimeInterface $created): self
70    {
71        $this->created = $created;
72        return $this;
73    }
74
75    public function getCreated(): DateTimeInterface
76    {
77        return $this->created;
78    }
79
80    // @codeCoverageIgnoreEnd
81    // }}} Autocode
82
83    public static function schemaDef(): array
84    {
85        return [
86            'name'        => 'group_inbox',
87            'description' => 'Many-many table listing activities posted to a given group, or which groups a given activity was posted to',
88            'fields'      => [
89                'group_id'    => ['type' => 'int',      'foreign key' => true, 'target' => 'Group.id', 'multiplicity' => 'one to one', 'name' => 'group_inbox_group_id_fkey', 'not null' => true, 'description' => 'group receiving the activity'],
90                'activity_id' => ['type' => 'int',      'foreign key' => true, 'target' => 'Activity.id', 'multiplicity' => 'many to one', 'name' => 'group_inbox_activity_id_fkey', 'not null' => true, 'description' => 'activity received'],
91                'created'     => ['type' => 'datetime', 'not null' => true,    'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
92            ],
93            'primary key' => ['group_id', 'activity_id'],
94            'indexes'     => [
95                'group_inbox_activity_id_idx'                  => ['activity_id'],
96                'group_inbox_group_id_created_activity_id_idx' => ['group_id', 'created', 'activity_id'],
97                'group_inbox_created_idx'                      => ['created'],
98            ],
99        ];
100    }
101}