Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
NoteTag | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
7 | |
100.00% |
1 / 1 |
setTag | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getTag | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
setNoteId | n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||||
getNoteId | 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% |
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 Notice Tag |
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 NoteTag extends Entity |
40 | { |
41 | // {{{ Autocode |
42 | // @codeCoverageIgnoreStart |
43 | private string $tag; |
44 | private int $note_id; |
45 | private \DateTimeInterface $created; |
46 | |
47 | public function setTag(string $tag): self |
48 | { |
49 | $this->tag = $tag; |
50 | return $this; |
51 | } |
52 | |
53 | public function getTag(): string |
54 | { |
55 | return $this->tag; |
56 | } |
57 | |
58 | public function setNoteId(int $note_id): self |
59 | { |
60 | $this->note_id = $note_id; |
61 | return $this; |
62 | } |
63 | |
64 | public function getNoteId(): int |
65 | { |
66 | return $this->note_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' => 'note_tag', |
87 | 'description' => 'Hash tags on notes', |
88 | 'fields' => [ |
89 | 'tag' => ['type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'hash tag associated with this note'], |
90 | 'note_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Note.id', 'multiplicity' => 'one to one', 'not null' => true, 'description' => 'foreign key to tagged note'], |
91 | 'created' => ['type' => 'datetime', 'not null' => true, 'default' => 'CURRENT_TIMESTAMP', 'description' => 'date this record was modified'], |
92 | ], |
93 | 'primary key' => ['tag', 'note_id'], |
94 | 'indexes' => [ |
95 | 'note_tag_created_idx' => ['created'], |
96 | 'note_tag_note_id_idx' => ['note_id'], |
97 | 'note_tag_tag_created_note_id_idx' => ['tag', 'created', 'note_id'], |
98 | ], |
99 | ]; |
100 | } |
101 | } |