@@ -31,12 +31,13 @@ discard block |
||
31 | 31 | $payload = json_decode($request->getContent()); |
32 | 32 | if (isset($payload->link_type)) { |
33 | 33 | $company = $this->manager->getRepository(People::class)->find(preg_replace('/\D/', '', $payload->company)); |
34 | - if ($company) |
|
35 | - $this->addLink($company, $people, $payload->link_type); |
|
36 | - else { |
|
34 | + if ($company) { |
|
35 | + $this->addLink($company, $people, $payload->link_type); |
|
36 | + } else { |
|
37 | 37 | $link = $this->manager->getRepository(People::class)->find(preg_replace('/\D/', '', $payload->link)); |
38 | - if ($payload->link_type == 'employee' && $link) |
|
39 | - $this->addLink($people, $link, $payload->link_type); |
|
38 | + if ($payload->link_type == 'employee' && $link) { |
|
39 | + $this->addLink($people, $link, $payload->link_type); |
|
40 | + } |
|
40 | 41 | } |
41 | 42 | } |
42 | 43 | } |
@@ -50,8 +51,9 @@ discard block |
||
50 | 51 | 'link_type' => $link_type |
51 | 52 | ]); |
52 | 53 | |
53 | - if (!$peopleLink) |
|
54 | - $peopleLink = new PeopleLink(); |
|
54 | + if (!$peopleLink) { |
|
55 | + $peopleLink = new PeopleLink(); |
|
56 | + } |
|
55 | 57 | |
56 | 58 | $peopleLink->setCompany($company); |
57 | 59 | $peopleLink->setPeople($people); |