예제 #1
0
 /**
  * Creates the structure into the database
  * NEVER! Call this on a server database!
  */
 public function createStructure()
 {
     $tool = new SchemaTool($this->entityManager);
     $classes = array();
     $dir = ROOT_DIR . 'mappings' . DS . 'internal' . DS;
     if ($handle = opendir($dir)) {
         while (false !== ($entry = readdir($handle))) {
             if (is_file($dir . $entry) && StringUtils::endsWith($entry, '.dcm.xml')) {
                 $entry = substr($entry, 0, strlen($entry) - strlen('.dcm.xml'));
                 $entry = str_replace('.', '\\', $entry);
                 $classes[] = $this->entityManager->getClassMetadata($entry);
             }
         }
     }
     $tool->updateSchema($classes);
 }
예제 #2
0
 /**
  * @return string
  */
 protected function detectBaseUrl()
 {
     $base_url = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off' ? 'https' : 'http';
     $base_url .= '://' . $_SERVER['HTTP_HOST'];
     $base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
     if (StringUtils::endsWith($base_url, '//')) {
         $base_url = substr($base_url, 0, -1);
     }
     return $base_url;
 }