Conditions | 1 |
Paths | 1 |
Total Lines | 20 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 1 |
Changes | 0 |
1 | <?php namespace Pz\Doctrine\Rest\Action\Relationships; |
||
28 | 1 | public function handle($request) |
|
29 | { |
||
30 | 1 | $entity = $this->repository()->findById($request->getId()); |
|
31 | |||
32 | 1 | $this->authorize($request, $entity); |
|
33 | |||
34 | 1 | $item = $this->getRelatedEntity($request->getData()); |
|
35 | |||
36 | 1 | $this->setProperty($entity, $this->field(), $item); |
|
37 | |||
38 | 1 | $this->repository()->getEntityManager()->flush($entity); |
|
39 | |||
40 | return ( |
||
41 | 1 | new RelationshipsItemAction( |
|
42 | 1 | $this->repository(), |
|
43 | 1 | $this->field(), |
|
44 | 1 | $this->related(), |
|
45 | 1 | $this->transformer() |
|
|
|||
46 | ) |
||
47 | 1 | )->dispatch($request); |
|
48 | } |
||
50 |