Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 30 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
FeedbackCommentsEntityDao | |
0.00% |
0 / 30 |
|
0.00% |
0 / 4 |
20 | |
0.00% |
0 / 1 |
selectExistsFeedbackCommentsBySequence | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
insertFeedbackComments | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
2 | |||
updateFeedbackComments | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
2 | |||
deleteFeedbackCommentsBySequence | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace PeServer\App\Models\Dao\Entities; |
6 | |
7 | use PeServer\App\Models\Data\Dto\CrashReportListItemDto; |
8 | use PeServer\Core\Binary; |
9 | use PeServer\Core\Database\DaoBase; |
10 | use PeServer\Core\Database\DaoTrait; |
11 | use PeServer\Core\Database\IDatabaseContext; |
12 | use PeServer\Core\Serialization\Mapper; |
13 | |
14 | class FeedbackCommentsEntityDao extends DaoBase |
15 | { |
16 | use DaoTrait; |
17 | |
18 | #region function |
19 | |
20 | |
21 | public function selectExistsFeedbackCommentsBySequence(int $sequence): bool |
22 | { |
23 | return 1 === $this->context->selectSingleCount( |
24 | <<<SQL |
25 | |
26 | select |
27 | count(*) |
28 | from |
29 | feedback_comments |
30 | where |
31 | feedback_comments.feedback_sequence = :sequence |
32 | |
33 | SQL, |
34 | [ |
35 | 'sequence' => $sequence, |
36 | ] |
37 | ); |
38 | } |
39 | |
40 | public function insertFeedbackComments(int $sequence, string $comment): void |
41 | { |
42 | $this->context->insertSingle( |
43 | <<<SQL |
44 | |
45 | insert into |
46 | feedback_comments |
47 | ( |
48 | [feedback_sequence], |
49 | [comment] |
50 | ) |
51 | values |
52 | ( |
53 | :feedback_sequence, |
54 | :comment |
55 | ) |
56 | |
57 | SQL, |
58 | [ |
59 | 'feedback_sequence' => $sequence, |
60 | 'comment' => $comment, |
61 | ] |
62 | ); |
63 | } |
64 | |
65 | public function updateFeedbackComments(int $sequence, string $comment): void |
66 | { |
67 | $this->context->updateByKey( |
68 | <<<SQL |
69 | |
70 | update |
71 | feedback_comments |
72 | set |
73 | [comment] = :comment |
74 | where |
75 | [feedback_sequence] = :feedback_sequence |
76 | |
77 | SQL, |
78 | [ |
79 | 'feedback_sequence' => $sequence, |
80 | 'comment' => $comment, |
81 | ] |
82 | ); |
83 | } |
84 | |
85 | public function deleteFeedbackCommentsBySequence(int $sequence): bool |
86 | { |
87 | return $this->context->deleteByKeyOrNothing( |
88 | <<<SQL |
89 | |
90 | delete |
91 | from |
92 | feedback_comments |
93 | where |
94 | feedback_sequence = :feedback_sequence |
95 | |
96 | SQL, |
97 | [ |
98 | 'feedback_sequence' => $sequence, |
99 | ] |
100 | ); |
101 | } |
102 | |
103 | #endregion |
104 | } |