diff --git a/api/src/Service/ApplicationService.php b/api/src/Service/ApplicationService.php index 13af135d4..119049407 100644 --- a/api/src/Service/ApplicationService.php +++ b/api/src/Service/ApplicationService.php @@ -49,8 +49,8 @@ public function getApplication() $public = ($this->request->headers->get('public') ?? $this->request->query->get('public')); // get host/domain -// $host = ($this->request->headers->get('host') ?? $this->request->query->get('host')); - $host = 'api.buren.commonground.nu'; + $host = ($this->request->headers->get('host') ?? $this->request->query->get('host')); +// $host = 'api.buren.commonground.nu'; ($application = $this->entityManager->getRepository('App:Application')->findOneBy(['public' => $public])) && !empty($application) && $this->session->set('application', $application->getId()->toString()); if (!$application) { @@ -60,15 +60,15 @@ public function getApplication() // $application = $this->entityManager->getRepository('App:Application')->findAll()-> $applications = $this->entityManager->getRepository('App:Application')->findAll(); -// foreach ($applications as $app) { -// $app->getDomains() !== null && in_array($host, $app->getDomains()) && $application = $app; -// if (isset($application)) { -// break; -// } -// } - if(count($applications) > 0) { - $application = $applications[0]; + foreach ($applications as $app) { + $app->getDomains() !== null && in_array($host, $app->getDomains()) && $application = $app; + if (isset($application)) { + break; + } } +// if(count($applications) > 0) { +// $application = $applications[0]; +// } } if (!$application) {