Total Complexity | 4 |
Total Lines | 29 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
13 | class DeleteStep extends AbstractStep |
||
14 | { |
||
15 | /** |
||
16 | * @var EntityManager |
||
17 | */ |
||
18 | protected $manager; |
||
19 | |||
20 | public function execute() |
||
21 | { |
||
22 | $entity = $this->getFromResponse('entity'); |
||
23 | |||
24 | try { |
||
25 | $this->manager->remove($entity); |
||
26 | $this->manager->flush(); |
||
27 | } catch (ORMException $exception) { |
||
28 | throw new BadRequestHttpException('Your request can not be processed', $exception); |
||
29 | } |
||
30 | |||
31 | $this->createResponse(['response_data' => null], true, 204); |
||
32 | } |
||
33 | |||
34 | public function setDoctrine(EntityManager $manager) |
||
35 | { |
||
36 | $this->manager = $manager; |
||
37 | } |
||
38 | |||
39 | public function requiresBefore() |
||
42 | } |
||
43 | |||
44 | } |