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