public function getSiteById($idSite, $env, $includeSite404Table = false)
	{
        // Retrieve cache version if front mode to avoid multiple calls
	    $cacheKey = get_class($this) . '_getSiteById_' . $idSite . '_' . $env . '_' . $includeSite404Table;
        $cacheConfig = 'engine_page_services';
        $melisEngineCacheSystem = $this->getServiceLocator()->get('MelisEngineCacheSystem');
        $results = $melisEngineCacheSystem->getCacheByKey($cacheKey, $cacheConfig);
        if (!empty($results)) return $results;
	    
		$select = $this->tableGateway->getSql()->select();
		
		$select->columns(array('*'));
	
		$siteDomainjoin = new Expression('melis_cms_site_domain.sdom_site_id = melis_cms_site.site_id AND sdom_env =\''.$env.'\'');
		
		if($includeSite404Table) {
		    
		    $site404join = new Expression('melis_cms_site_domain.sdom_site_id = melis_cms_site.site_id');
		    
		    $select->join('melis_cms_site_domain', $siteDomainjoin, array('*'), $select::JOIN_LEFT)
		           ->join('melis_cms_site_404', $site404join, array('*'), $select::JOIN_LEFT);
		}
		else {
		    $select->join('melis_cms_site_domain', $siteDomainjoin, array('*'), $select::JOIN_LEFT);
		}
		
		$select->where('site_id ='.$idSite);
	
		$resultSet = $this->tableGateway->selectWith($select);

		$melisEngineCacheSystem->setCacheByKey($cacheKey, $cacheConfig, $resultSet);
		
		return $resultSet;
	}
public function getSiteById($idSite, $env, $includeSite404Table = false)
	{
        // Retrieve cache version if front mode to avoid multiple calls
	    $cacheKey = get_class($this) . '_getSiteById_' . $idSite . '_' . $env . '_' . $includeSite404Table;
        $cacheConfig = 'engine_page_services';
        $melisEngineCacheSystem = $this->getServiceLocator()->get('MelisEngineCacheSystem');
        $results = $melisEngineCacheSystem->getCacheByKey($cacheKey, $cacheConfig);
        if (!empty($results)) return $results;
	    
		$select = $this->tableGateway->getSql()->select();
		
		$select->columns(array('*'));
	
		$siteDomainjoin = new Expression('melis_cms_site_domain.sdom_site_id = melis_cms_site.site_id AND sdom_env =\''.$env.'\'');
		
		if($includeSite404Table) {
		    
		    $site404join = new Expression('melis_cms_site_domain.sdom_site_id = melis_cms_site.site_id');
		    
		    $select->join('melis_cms_site_domain', $siteDomainjoin, array('*'), $select::JOIN_LEFT)
		           ->join('melis_cms_site_404', $site404join, array('*'), $select::JOIN_LEFT);
		}
		else {
		    $select->join('melis_cms_site_domain', $siteDomainjoin, array('*'), $select::JOIN_LEFT);
		}
		
		$select->where('site_id ='.$idSite);
	
		$resultSet = $this->tableGateway->selectWith($select);

		$melisEngineCacheSystem->setCacheByKey($cacheKey, $cacheConfig, $resultSet);
		
		return $resultSet;
	}
public function getSiteById ( $ idSite , $ env , $ includeSite404Table = false ) { // Retrieve cache version if front mode to avoid multiple calls $ cacheKey = get_class ( $ this ) . '_getSiteById_' . $ idSite . '_' . $ env . '_' . $ includeSite404Table ; $ cacheConfig = 'engine_page_services' ; $ melisEngineCacheSystem = $ this -> getServiceLocator ( ) -> get ( 'MelisEngineCacheSystem' ) ; $ results = $ melisEngineCacheSystem -> getCacheByKey ( $ cacheKey , $ cacheConfig ) ; if ( ! empty ( $ results ) ) return $ results ; $ select = $ this -> tableGateway -> getSql ( ) -> select ( ) ; $ select -> columns ( array ( '*' ) ) ; $ siteDomainjoin = new Expression ( 'melis_cms_site_domain.sdom_site_id = melis_cms_site.site_id AND sdom_env =\'' . $ env . '\'' ) ; if ( $ includeSite404Table ) { $ site404join = new Expression ( 'melis_cms_site_domain.sdom_site_id = melis_cms_site.site_id' ) ; $ select -> join ( 'melis_cms_site_domain' , $ siteDomainjoin , array ( '*' ) , $ select :: JOIN_LEFT ) -> join ( 'melis_cms_site_404' , $ site404join , array ( '*' ) , $ select :: JOIN_LEFT ) ; } else { $ select -> join ( 'melis_cms_site_domain' , $ siteDomainjoin , array ( '*' ) , $ select :: JOIN_LEFT ) ; } $ select -> where ( 'site_id =' . $ idSite ) ; $ resultSet = $ this -> tableGateway -> selectWith ( $ select ) ; $ melisEngineCacheSystem -> setCacheByKey ( $ cacheKey , $ cacheConfig , $ resultSet ) ; return $ resultSet ; }
Gets a site by its id, and can restrict to an environment for the domain, and 404 datas

@param int $idSite
@param string $env
@param boolean $includeSite404Table
Gets a site by its id and can restrict to an environment for the domain and 404 datas