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($data['entities_dir']); $config->setMetadataDriverImpl($driverImpl); $config->setQueryCacheImpl($cache); $config->setProxyDir($data['proxies_dir']); $config->setProxyNamespace($configData['general']['app_name'] . '\\' . $cnx . '\\Proxies'); $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'); $emanagers[$cnx] = EntityManager::create($connectionOptions, $config); } } Registry::getInstance()->set('databases', $emanagers); if (isset($configData['m3_public_settings']['css_dir'])) { CssManager::setBaseDir($configData['m3_public_settings']['css_dir']); } if (isset($configData['m3_public_settings']['js_dir'])) { JsManager::setBaseDir($configData['m3_public_settings']['js_dir']); } self::clearPluginList(); $claseBootstrap = 'App\\Bootstrap'; $bootstrap = new $claseBootstrap(); $bootstrap->init(); }
public function setBaseUrlPublic($path) { $this->_baseUrlPublic = $path; $this->_cssManager->setBaseUrl($path); $this->_jsManager->setBaseUrl($path); }