src/Modules/OnlineService/Service/OnlineServiceService.php line 42
<?phpnamespace App\Modules\OnlineService\Service;use Symfony\Component\HttpFoundation\RequestStack;use Symfony\Component\Routing\RouterInterface;use Symfony\Component\Routing\Generator\UrlGeneratorInterface;class OnlineServiceService{private $_requestStack;private $_router;private $_iframeSessionKey = 'online_service.is_iframe';public function __construct(RequestStack $requestStack,RouterInterface $router){$this->_requestStack = $requestStack;$this->_router = $router;}public function checkIframe(){$request = $this->_requestStack->getMainRequest();if (!(bool)(int)$request->query->get('iframe'))return;$data = array('parent_url' => $request->query->get('parentUrl'));if ($data['parent_url'] == '')throw new \Exception('Invalid parameters.');$request->getSession()->set($this->_iframeSessionKey, $data);}public function getIframeData(){return $this->_requestStack->getMainRequest()->getSession()->get($this->_iframeSessionKey);}public function isIframe(){return $this->getIframeData() != null;}public function getUrl($route, array $params = array(), $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH){if ($this->isIframe())$params['_sid'] = session_id();return $this->_router->generate($route, $params, $referenceType);}}