Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
GroupAlias | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
7 | |
100.00% |
1 / 1 |
setAlias | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getAlias | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
setGroupId | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getGroupId | 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% |
1 / 1 |
1 | |
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 | |
20 | namespace App\Entity; |
21 | |
22 | use App\Core\Entity; |
23 | use DateTimeInterface; |
24 | |
25 | /** |
26 | * Entity for Group Alias |
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 | */ |
39 | class GroupAlias extends Entity |
40 | { |
41 | // {{{ Autocode |
42 | // @codeCoverageIgnoreStart |
43 | private string $alias; |
44 | private int $group_id; |
45 | private \DateTimeInterface $modified; |
46 | |
47 | public function setAlias(string $alias): self |
48 | { |
49 | $this->alias = $alias; |
50 | return $this; |
51 | } |
52 | |
53 | public function getAlias(): string |
54 | { |
55 | return $this->alias; |
56 | } |
57 | |
58 | public function setGroupId(int $group_id): self |
59 | { |
60 | $this->group_id = $group_id; |
61 | return $this; |
62 | } |
63 | |
64 | public function getGroupId(): int |
65 | { |
66 | return $this->group_id; |
67 | } |
68 | |
69 | public function setModified(DateTimeInterface $modified): self |
70 | { |
71 | $this->modified = $modified; |
72 | return $this; |
73 | } |
74 | |
75 | public function getModified(): DateTimeInterface |
76 | { |
77 | return $this->modified; |
78 | } |
79 | |
80 | // @codeCoverageIgnoreEnd |
81 | // }}} Autocode |
82 | |
83 | public static function schemaDef(): array |
84 | { |
85 | return [ |
86 | 'name' => 'group_alias', |
87 | 'fields' => [ |
88 | 'alias' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'additional nickname for the group'], |
89 | 'group_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Group.id', 'multiplicity' => 'many to one', 'not null' => true, 'description' => 'group id which this is an alias of'], |
90 | 'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'], |
91 | ], |
92 | 'primary key' => ['alias'], |
93 | 'indexes' => [ |
94 | 'group_alias_group_id_idx' => ['group_id'], |
95 | ], |
96 | ]; |
97 | } |
98 | } |