@@ -30,7 +30,7 @@ |
||
| 30 | 30 | * |
| 31 | 31 | * @var PeopleService |
| 32 | 32 | */ |
| 33 | - private $people = null; |
|
| 33 | + private $people = null; |
|
| 34 | 34 | |
| 35 | 35 | public function __construct( |
| 36 | 36 | EntityManagerInterface $entityManager, |
@@ -64,8 +64,9 @@ discard block |
||
| 64 | 64 | $mainCompany = $this->getMainCompany(); |
| 65 | 65 | |
| 66 | 66 | $isSuper = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'employee', 1); |
| 67 | - if ($isSuper) |
|
| 68 | - $peopleRole[] = 'super'; |
|
| 67 | + if ($isSuper) { |
|
| 68 | + $peopleRole[] = 'super'; |
|
| 69 | + } |
|
| 69 | 70 | |
| 70 | 71 | |
| 71 | 72 | |
@@ -76,13 +77,15 @@ discard block |
||
| 76 | 77 | } |
| 77 | 78 | |
| 78 | 79 | $isClient = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'client', 1); |
| 79 | - if ($isClient) |
|
| 80 | - $peopleRole[] = 'client'; |
|
| 80 | + if ($isClient) { |
|
| 81 | + $peopleRole[] = 'client'; |
|
| 82 | + } |
|
| 81 | 83 | |
| 82 | 84 | |
| 83 | 85 | $isSalesman = $this->manager->getRepository(People::class)->getCompanyPeopleLinks($mainCompany, $people, 'salesman', 1); |
| 84 | - if ($isSalesman) |
|
| 85 | - $peopleRole[] = 'salesman'; |
|
| 86 | + if ($isSalesman) { |
|
| 87 | + $peopleRole[] = 'salesman'; |
|
| 88 | + } |
|
| 86 | 89 | |
| 87 | 90 | |
| 88 | 91 | return array_values(array_unique(empty($peopleRole) ? ['guest'] : $peopleRole)); |
@@ -98,10 +101,11 @@ discard block |
||
| 98 | 101 | $domain = $_SERVER['HTTP_HOST']; |
| 99 | 102 | $company = $this->manager->getRepository(PeopleDomain::class)->findOneBy(['domain' => $domain]); |
| 100 | 103 | |
| 101 | - if ($company === null) |
|
| 102 | - throw new \Exception( |
|
| 104 | + if ($company === null) { |
|
| 105 | + throw new \Exception( |
|
| 103 | 106 | sprintf('Main company "%s" not found', $domain) |
| 104 | 107 | ); |
| 108 | + } |
|
| 105 | 109 | |
| 106 | 110 | return $company->getPeople(); |
| 107 | 111 | } |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
| 44 | - public function getCompanyPeopleLinks(People $company, People $people, $linkType = null, $maxResults = null) |
|
| 44 | + public function getCompanyPeopleLinks(People $company, People $people, $linkType = null, $maxResults = null) |
|
| 45 | 45 | { |
| 46 | 46 | $queryBuilder = $this->getEntityManager()->createQueryBuilder(); |
| 47 | 47 | $queryBuilder->select('pl') |
@@ -51,8 +51,9 @@ |
||
| 51 | 51 | ->setParameter('company', $company->getId()) |
| 52 | 52 | ->setParameter('people', $people->getId()); |
| 53 | 53 | |
| 54 | - if ($linkType) |
|
| 55 | - $queryBuilder->setParameter('linkType', $linkType)->andWhere('pl.link_type = :linkType'); |
|
| 54 | + if ($linkType) { |
|
| 55 | + $queryBuilder->setParameter('linkType', $linkType)->andWhere('pl.link_type = :linkType'); |
|
| 56 | + } |
|
| 56 | 57 | |
| 57 | 58 | if ($maxResults) { |
| 58 | 59 | $queryBuilder->setMaxResults($maxResults); |