Total Complexity | 4 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Coverage | 21.43% |
Changes | 0 |
1 | <?php |
||
14 | class DeleteStep extends AbstractStep |
||
15 | { |
||
16 | /** |
||
17 | * @var EntityManager |
||
18 | */ |
||
19 | protected $manager; |
||
20 | |||
21 | 1 | public function __construct(Registry $doctrine) |
|
24 | 1 | } |
|
25 | |||
26 | |||
27 | public function execute(Request $request) : ArtifactCollection |
||
28 | { |
||
29 | $entity = $this->getArtifact('entity'); |
||
30 | |||
31 | try { |
||
32 | $this->manager->remove($entity); |
||
33 | $this->manager->flush(); |
||
34 | } catch (\Exception $exception) { |
||
35 | throw new BadRequestHttpException('Your request can not be processed', $exception); |
||
36 | } |
||
37 | |||
38 | return new ArtifactCollection([ |
||
39 | new Artifact('data', null), |
||
40 | new Artifact('status', 204) |
||
41 | ]); |
||
42 | } |
||
43 | |||
44 | public function getRequiredArtifacts() : array |
||
47 | } |
||
48 | |||
49 | } |