/** * Constructor to initialize the YamlRepository with source * file config/DomainRepository.yml. */ public function __construct() { parent::__construct(\Env::get('cx')->getWebsiteConfigPath() . '/DomainRepository.yml'); //Initialize the Hostname Domain $hostName = new \Cx\Core\Net\Model\Entity\Domain($_SERVER['SERVER_NAME']); $hostName->setVirtual(true); //attach the hostname domain entity to repository $this->add($hostName); // set ID to 0 to make it having the same ID constantly $hostName->setId(0); }
/** * Constructor to initialize the YamlRepository with source * file config/DomainRepository.yml. */ public function __construct() { parent::__construct(\Env::get('cx')->getWebsiteConfigPath() . '/DomainRepository.yml'); //Initialize the Hostname Domain $hostName = $this->findOneBy(array('name' => $_SERVER['SERVER_NAME'])); if (!$hostName) { $hostName = new \Cx\Core\Net\Model\Entity\Domain($_SERVER['SERVER_NAME']); $hostName->setVirtual(true); //attach the hostname domain entity to repository $this->add($hostName); } else { throw new \Exception('Duplicate entry for this domain, see http://bugs.cloudrexx.com/cloudrexx/ticket/2763'); } $hostName->setVirtual(true); // set ID to 0 to make it having the same ID constantly $hostName->setId(0); }