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
RelatedGroup
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
 setRelatedGroupId
n/a
0 / 0
1
n/a
0 / 0
 getRelatedGroupId
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 related groups
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 RelatedGroup extends Entity
40{
41    // {{{ Autocode
42    // @codeCoverageIgnoreStart
43    private int $group_id;
44    private int $related_group_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 setRelatedGroupId(int $related_group_id): self
59    {
60        $this->related_group_id = $related_group_id;
61        return $this;
62    }
63
64    public function getRelatedGroupId(): int
65    {
66        return $this->related_group_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' => 'related_group',
87            // @fixme description for related_group?
88            'fields' => [
89                'group_id'         => ['type' => 'int',      'foreign key' => true, 'target' => 'Group.id', 'multiplicity' => 'one to one', 'not null' => true, 'description' => 'foreign key to group'],
90                'related_group_id' => ['type' => 'int',      'foreign key' => true, 'target' => 'Group.id', 'multiplicity' => 'one to one', 'type' => 'int', 'not null' => true, 'description' => 'foreign key to group'],
91                'created'          => ['type' => 'datetime', 'not null' => true,    'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'],
92            ],
93            'primary key' => ['group_id', 'related_group_id'],
94        ];
95    }
96}