Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 12 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
AjaxCrashReportDeleteLogic | |
0.00% |
0 / 12 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
validateImpl | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
executeImpl | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace PeServer\App\Models\Domain\Page\Ajax; |
6 | |
7 | use PeServer\App\Models\Dao\Entities\CrashReportCommentsEntityDao; |
8 | use PeServer\App\Models\Dao\Entities\CrashReportsEntityDao; |
9 | use PeServer\App\Models\Domain\Page\PageLogicBase; |
10 | use PeServer\App\Models\ResponseJson; |
11 | use PeServer\Core\Database\IDatabaseContext; |
12 | use PeServer\Core\IO\Path; |
13 | use PeServer\Core\Mvc\LogicCallMode; |
14 | use PeServer\Core\Mvc\LogicParameter; |
15 | use PeServer\Core\Throws\FileNotFoundException; |
16 | |
17 | class AjaxCrashReportDeleteLogic extends PageLogicBase |
18 | { |
19 | public function __construct(LogicParameter $parameter) |
20 | { |
21 | parent::__construct($parameter); |
22 | } |
23 | |
24 | #region PageLogicBase |
25 | |
26 | protected function validateImpl(LogicCallMode $callMode): void |
27 | { |
28 | //NOP |
29 | } |
30 | |
31 | protected function executeImpl(LogicCallMode $callMode): void |
32 | { |
33 | $sequence = (int)$this->getRequest('sequence'); |
34 | |
35 | $database = $this->openDatabase(); |
36 | $database->transaction(function (IDatabaseContext $context) use ($sequence) { |
37 | $crashReportsEntityDao = new CrashReportsEntityDao($context); |
38 | $crashReportCommentsEntityDao = new CrashReportCommentsEntityDao($context); |
39 | |
40 | $crashReportCommentsEntityDao->deleteCrashReportCommentsBySequence($sequence); |
41 | $crashReportsEntityDao->deleteCrashReportsBySequence($sequence); |
42 | return true; |
43 | }); |
44 | |
45 | $this->setResponseJson(ResponseJson::success([])); |
46 | } |
47 | |
48 | #endregion |
49 | } |