Listeners/MaintenanceListener.php
public function onKernelRequest(GetResponseEvent $e){
        $request = $e->getRequest();

        $currentDomain = $request->getHttpHost();

        $this->session = $this->kernel->getContainer()->get('session');
        if(!$this->session->get('is_logged_in')){
            $response = $this->siteManagement->getSiteByDomain(str_replace('www.', '', $currentDomain));
            $routeName = $request->get('_route');
            if(!$response->error->exist){
                $settings = json_decode($response->result->set->getSettings());
                if(is_object($settings) && isset($settings->maintenance) && $settings->maintenance == true){
                    $url = $this->kernel->getContainer()->get('router')->generate($this->kernel->getContainer()->getParameter('maintenance_route'), array(), UrlGeneratorInterface::ABSOLUTE_PATH);
                    if($this->kernel->getContainer()->getParameter('maintenance_route') != $routeName){
                        $e->setResponse(new RedirectResponse($url));
                    }
                }
            }
            if($this->kernel->getContainer()->getParameter('maintenance') !== null && $this->kernel->getContainer()->getParameter('maintenance') === true){
                $url = $this->kernel->getContainer()->get('router')->generate($this->kernel->getContainer()->getParameter('maintenance_route'), array(), UrlGeneratorInterface::ABSOLUTE_PATH);
                if($this->kernel->getContainer()->getParameter('maintenance_route') != $routeName){
                    $e->setResponse(new RedirectResponse($url));
                }
            }
        }
    }
public function onKernelRequest(GetResponseEvent $e){
        $request = $e->getRequest();

        $currentDomain = $request->getHttpHost();

        $this->session = $this->kernel->getContainer()->get('session');
        if(!$this->session->get('is_logged_in')){
            $response = $this->siteManagement->getSiteByDomain(str_replace('www.', '', $currentDomain));
            $routeName = $request->get('_route');
            if(!$response->error->exist){
                $settings = json_decode($response->result->set->getSettings());
                if(is_object($settings) && isset($settings->maintenance) && $settings->maintenance == true){
                    $url = $this->kernel->getContainer()->get('router')->generate($this->kernel->getContainer()->getParameter('maintenance_route'), array(), UrlGeneratorInterface::ABSOLUTE_PATH);
                    if($this->kernel->getContainer()->getParameter('maintenance_route') != $routeName){
                        $e->setResponse(new RedirectResponse($url));
                    }
                }
            }
            if($this->kernel->getContainer()->getParameter('maintenance') !== null && $this->kernel->getContainer()->getParameter('maintenance') === true){
                $url = $this->kernel->getContainer()->get('router')->generate($this->kernel->getContainer()->getParameter('maintenance_route'), array(), UrlGeneratorInterface::ABSOLUTE_PATH);
                if($this->kernel->getContainer()->getParameter('maintenance_route') != $routeName){
                    $e->setResponse(new RedirectResponse($url));
                }
            }
        }
    }
@name 			onKernelRequest()

@author          Can Berkol

@since			1.0.0
@version         1.0.0

@param 			GetResponseEvent 	        $e