Example #1
0
 public static function initSite($configFile, $component = '')
 {
     $config = self::loadConfigFile($configFile);
     $configData = $config->getArray();
     $emanagers = array();
     foreach ($configData as $key => $data) {
         if (strpos($key, 'db_') === 0) {
             $host = $data['db_host'];
             $user = $data['db_user'];
             $pass = $data['db_pass'];
             $name = $data['db_name'];
             $cnx = $data['cnx_name'];
             $cache = new \Doctrine\Common\Cache\ArrayCache();
             $config = new Configuration();
             $config->setMetadataCacheImpl($cache);
             $driverImpl = $config->newDefaultAnnotationDriver($configData['m3_general_db']['base_dir'] . $cnx . '/Entity');
             $config->setMetadataDriverImpl($driverImpl);
             $config->setQueryCacheImpl($cache);
             $config->setProxyDir($configData['m3_general_db']['base_dir'] . $cnx . '/Proxy');
             $config->setProxyNamespace($configData['general']['app_name'] . '\\' . $cnx . '\\Proxy');
             $config->setAutoGenerateProxyClasses(true);
             /**
              * Por el momento Model3 se basa en proyectos orientados a MySQL
              */
             $connectionOptions = array('dbname' => $name, 'user' => $user, 'password' => $pass, 'host' => $host, 'driver' => 'pdo_mysql', 'charset' => 'utf8', 'driverOptions' => array(1002 => 'SET NAMES utf8'));
             $emanagers[$cnx] = EntityManager::create($connectionOptions, $config);
         }
     }
     Model3_Registry::getInstance()->set('databases', $emanagers);
     if (isset($configData['m3_public_settings']['css_dir'])) {
         Model3_CssManager::setBaseDir($configData['m3_public_settings']['css_dir']);
     }
     if (isset($configData['m3_public_settings']['js_dir'])) {
         Model3_JsManager::setBaseDir($configData['m3_public_settings']['js_dir']);
     }
     self::clearPluginList();
     $claseBootstrap = $component . 'Bootstrap';
     $bootstrap = new $claseBootstrap();
     $bootstrap->init();
 }
Example #2
0
 public function setBaseUrlPublic($path)
 {
     $this->_baseUrlPublic = $path;
     $this->_cssManager->setBaseUrl($path);
     $this->_jsManager->setBaseUrl($path);
 }
Example #3
0
 public static function setBaseDir($path = '')
 {
     self::$_baseDir = $path;
 }