Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| GroupMember | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
13 | |
100.00% |
1 / 1 |
| setGroupId | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getGroupId | 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 |
|||||
| setIsAdmin | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getIsAdmin | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| setUri | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
| getUri | 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% |
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 a Group Member |
| 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 GroupMember extends Entity |
| 40 | { |
| 41 | // {{{ Autocode |
| 42 | // @codeCoverageIgnoreStart |
| 43 | private int $group_id; |
| 44 | private int $gsactor_id; |
| 45 | private ?bool $is_admin; |
| 46 | private ?string $uri; |
| 47 | private \DateTimeInterface $created; |
| 48 | private \DateTimeInterface $modified; |
| 49 | |
| 50 | public function setGroupId(int $group_id): self |
| 51 | { |
| 52 | $this->group_id = $group_id; |
| 53 | return $this; |
| 54 | } |
| 55 | |
| 56 | public function getGroupId(): int |
| 57 | { |
| 58 | return $this->group_id; |
| 59 | } |
| 60 | |
| 61 | public function setGSActorId(int $gsactor_id): self |
| 62 | { |
| 63 | $this->gsactor_id = $gsactor_id; |
| 64 | return $this; |
| 65 | } |
| 66 | |
| 67 | public function getGSActorId(): int |
| 68 | { |
| 69 | return $this->gsactor_id; |
| 70 | } |
| 71 | |
| 72 | public function setIsAdmin(?bool $is_admin): self |
| 73 | { |
| 74 | $this->is_admin = $is_admin; |
| 75 | return $this; |
| 76 | } |
| 77 | |
| 78 | public function getIsAdmin(): ?bool |
| 79 | { |
| 80 | return $this->is_admin; |
| 81 | } |
| 82 | |
| 83 | public function setUri(?string $uri): self |
| 84 | { |
| 85 | $this->uri = $uri; |
| 86 | return $this; |
| 87 | } |
| 88 | |
| 89 | public function getUri(): ?string |
| 90 | { |
| 91 | return $this->uri; |
| 92 | } |
| 93 | |
| 94 | public function setCreated(DateTimeInterface $created): self |
| 95 | { |
| 96 | $this->created = $created; |
| 97 | return $this; |
| 98 | } |
| 99 | |
| 100 | public function getCreated(): DateTimeInterface |
| 101 | { |
| 102 | return $this->created; |
| 103 | } |
| 104 | |
| 105 | public function setModified(DateTimeInterface $modified): self |
| 106 | { |
| 107 | $this->modified = $modified; |
| 108 | return $this; |
| 109 | } |
| 110 | |
| 111 | public function getModified(): DateTimeInterface |
| 112 | { |
| 113 | return $this->modified; |
| 114 | } |
| 115 | |
| 116 | // @codeCoverageIgnoreEnd |
| 117 | // }}} Autocode |
| 118 | |
| 119 | public static function schemaDef(): array |
| 120 | { |
| 121 | return [ |
| 122 | 'name' => 'group_member', |
| 123 | 'fields' => [ |
| 124 | 'group_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Group.id', 'multiplicity' => 'one to one', 'name' => 'group_member_group_id_fkey', 'not null' => true, 'description' => 'foreign key to group table'], |
| 125 | 'gsactor_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'GSActor.id', 'multiplicity' => 'one to one', 'name' => 'group_member_gsactor_id_fkey', 'not null' => true, 'description' => 'foreign key to gsactor table'], |
| 126 | 'is_admin' => ['type' => 'bool', 'default' => false, 'description' => 'is this actor an admin?'], |
| 127 | 'uri' => ['type' => 'varchar', 'length' => 191, 'description' => 'universal identifier'], |
| 128 | 'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was created'], |
| 129 | 'modified' => ['type' => 'timestamp', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'], |
| 130 | ], |
| 131 | 'primary key' => ['group_id', 'gsactor_id'], |
| 132 | 'unique keys' => [ |
| 133 | 'group_member_uri_key' => ['uri'], |
| 134 | ], |
| 135 | 'indexes' => [ |
| 136 | 'group_member_gsactor_id_idx' => ['gsactor_id'], |
| 137 | 'group_member_created_idx' => ['created'], |
| 138 | 'group_member_gsactor_id_created_idx' => ['gsactor_id', 'created'], |
| 139 | 'group_member_group_id_created_idx' => ['group_id', 'created'], |
| 140 | ], |
| 141 | ]; |
| 142 | } |
| 143 | } |