Services/SiteManagementModel.php
public function getSite($site) {
		$timeStamp = time();
		if($site instanceof BundleEntity\Site){
			return new ModelResponse($site, 1, 0, null, false, 'S:D:002', 'Entries successfully fetched from database.', $timeStamp, time());
		}
		$result = null;
		switch($site){
			case is_numeric($site):
				$result = $this->em->getRepository($this->entity['s']['name'])->findOneBy(array('id' => $site));
				break;
			case is_string($site):
				$result = $this->em->getRepository($this->entity['s']['name'])->findOneBy(array('url_key' => $site));
				if(is_null($result)){
					$response = $this->getSiteByDomain($site);
					if(!$response->error->exist){
						$result = $response->result->set;
					}
				}
				break;
		}
		if(is_null($result)){
			return new ModelResponse($result, 0, 0, null, true, 'E:D:002', 'Unable to find request entry in database.', $timeStamp, time());
		}

		return new ModelResponse($result, 1, 0, null, false, 'S:D:002', 'Entries successfully fetched from database.', $timeStamp, time());
	}
public function getSite($site) {
		$timeStamp = time();
		if($site instanceof BundleEntity\Site){
			return new ModelResponse($site, 1, 0, null, false, 'S:D:002', 'Entries successfully fetched from database.', $timeStamp, time());
		}
		$result = null;
		switch($site){
			case is_numeric($site):
				$result = $this->em->getRepository($this->entity['s']['name'])->findOneBy(array('id' => $site));
				break;
			case is_string($site):
				$result = $this->em->getRepository($this->entity['s']['name'])->findOneBy(array('url_key' => $site));
				if(is_null($result)){
					$response = $this->getSiteByDomain($site);
					if(!$response->error->exist){
						$result = $response->result->set;
					}
				}
				break;
		}
		if(is_null($result)){
			return new ModelResponse($result, 0, 0, null, true, 'E:D:002', 'Unable to find request entry in database.', $timeStamp, time());
		}

		return new ModelResponse($result, 1, 0, null, false, 'S:D:002', 'Entries successfully fetched from database.', $timeStamp, time());
	}
public function getSite ( $ site ) { $ timeStamp = time ( ) ; if ( $ site instanceof BundleEntity \ Site ) { return new ModelResponse ( $ site , 1 , 0 , null , false , 'S:D:002' , 'Entries successfully fetched from database.' , $ timeStamp , time ( ) ) ; } $ result = null ; switch ( $ site ) { case is_numeric ( $ site ) : $ result = $ this -> em -> getRepository ( $ this -> entity [ 's' ] [ 'name' ] ) -> findOneBy ( array ( 'id' => $ site ) ) ; break ; case is_string ( $ site ) : $ result = $ this -> em -> getRepository ( $ this -> entity [ 's' ] [ 'name' ] ) -> findOneBy ( array ( 'url_key' => $ site ) ) ; if ( is_null ( $ result ) ) { $ response = $ this -> getSiteByDomain ( $ site ) ; if ( ! $ response -> error -> exist ) { $ result = $ response -> result -> set ; } } break ; } if ( is_null ( $ result ) ) { return new ModelResponse ( $ result , 0 , 0 , null , true , 'E:D:002' , 'Unable to find request entry in database.' , $ timeStamp , time ( ) ) ; } return new ModelResponse ( $ result , 1 , 0 , null , false , 'S:D:002' , 'Entries successfully fetched from database.' , $ timeStamp , time ( ) ) ; }
@name 			getSite()

@since			1.0.0
@version         1.1.2
@author          Can Berkol

@use				$this->createException();

@param           mixed           $site           Site entity or site id.

@return          \BiberLtd\Bundle\CoreBundle\Responses\ModelResponse
@name getSite ()