public function getSiteByPageId($idPage)
	{
	    if (empty($idPage))
	        return null;
	    
        // Retrieve cache version if front mode to avoid multiple calls
        $cacheKey = 'getSiteByPageId_' . $idPage;
        $cacheConfig = 'engine_page_services';
        $melisEngineCacheSystem = $this->serviceLocator->get('MelisEngineCacheSystem');
        $results = $melisEngineCacheSystem->getCacheByKey($cacheKey, $cacheConfig);
        if (!empty($results)) return $results;
	    
        $datasSite = null;
		$melisPage = $this->getServiceLocator()->get('MelisEnginePage');
		$datasPage = $melisPage->getDatasPage($idPage);
		$datasTemplate = $datasPage->getMelisTemplate();
		if (!empty($datasTemplate) && !empty($datasTemplate->tpl_site_id))
		{
			$melisEngineTableSite = $this->getServiceLocator()->get('MelisEngineTableSite');
			$datasSite = $melisEngineTableSite->getSiteById($datasTemplate->tpl_site_id, getenv('MELIS_PLATFORM'));
			if ($datasSite)
			{
				$datasSite = $datasSite->current();
			}
		}

		// Save cache key
		$melisEngineCacheSystem->setCacheByKey($cacheKey, $cacheConfig, $datasSite);
		
		return $datasSite;
	}
public function getSiteByPageId($idPage)
	{
	    if (empty($idPage))
	        return null;
	    
        // Retrieve cache version if front mode to avoid multiple calls
        $cacheKey = 'getSiteByPageId_' . $idPage;
        $cacheConfig = 'engine_page_services';
        $melisEngineCacheSystem = $this->serviceLocator->get('MelisEngineCacheSystem');
        $results = $melisEngineCacheSystem->getCacheByKey($cacheKey, $cacheConfig);
        if (!empty($results)) return $results;
	    
        $datasSite = null;
		$melisPage = $this->getServiceLocator()->get('MelisEnginePage');
		$datasPage = $melisPage->getDatasPage($idPage);
		$datasTemplate = $datasPage->getMelisTemplate();
		if (!empty($datasTemplate) && !empty($datasTemplate->tpl_site_id))
		{
			$melisEngineTableSite = $this->getServiceLocator()->get('MelisEngineTableSite');
			$datasSite = $melisEngineTableSite->getSiteById($datasTemplate->tpl_site_id, getenv('MELIS_PLATFORM'));
			if ($datasSite)
			{
				$datasSite = $datasSite->current();
			}
		}

		// Save cache key
		$melisEngineCacheSystem->setCacheByKey($cacheKey, $cacheConfig, $datasSite);
		
		return $datasSite;
	}
public function getSiteByPageId ( $ idPage ) { if ( empty ( $ idPage ) ) return null ; // Retrieve cache version if front mode to avoid multiple calls $ cacheKey = 'getSiteByPageId_' . $ idPage ; $ cacheConfig = 'engine_page_services' ; $ melisEngineCacheSystem = $ this -> serviceLocator -> get ( 'MelisEngineCacheSystem' ) ; $ results = $ melisEngineCacheSystem -> getCacheByKey ( $ cacheKey , $ cacheConfig ) ; if ( ! empty ( $ results ) ) return $ results ; $ datasSite = null ; $ melisPage = $ this -> getServiceLocator ( ) -> get ( 'MelisEnginePage' ) ; $ datasPage = $ melisPage -> getDatasPage ( $ idPage ) ; $ datasTemplate = $ datasPage -> getMelisTemplate ( ) ; if ( ! empty ( $ datasTemplate ) && ! empty ( $ datasTemplate -> tpl_site_id ) ) { $ melisEngineTableSite = $ this -> getServiceLocator ( ) -> get ( 'MelisEngineTableSite' ) ; $ datasSite = $ melisEngineTableSite -> getSiteById ( $ datasTemplate -> tpl_site_id , getenv ( 'MELIS_PLATFORM' ) ) ; if ( $ datasSite ) { $ datasSite = $ datasSite -> current ( ) ; } } // Save cache key $ melisEngineCacheSystem -> setCacheByKey ( $ cacheKey , $ cacheConfig , $ datasSite ) ; return $ datasSite ; }
Gets the site object of a page id

@param int $idPage
Gets the site object of a page id