コード例 #1
0
ファイル: PackagesConfigurator.php プロジェクト: solve/solve
 public function onKernelReady(BaseEvent $event)
 {
     $this->onEnvironmentUpdate($event);
     if ($webRoot = DC::getProjectConfig('webRoot')) {
         DC::getEnvironment()->setWebRoot($webRoot);
     }
     $databaseConfig = DC::getDatabaseConfig();
     $request = DC::getRouter()->getCurrentRequest();
     if ($profiles = $databaseConfig->get('profiles')) {
         foreach ($profiles as $profileName => $profileInfo) {
             DatabaseService::configProfile($profileInfo, $profileName);
         }
         if (empty($request) || $request && !$request->isConsoleRequest()) {
             ModelOperator::getInstance(DC::getEnvironment()->getUserClassesRoot() . 'db/');
             if ($databaseConfig->get('autoUpdateAll')) {
                 ModelOperator::getInstance()->generateAllModelClasses()->updateDBForAllModels();
             }
         }
     }
 }
コード例 #2
0
ファイル: DbController.php プロジェクト: solve/solve
 /**
  * Created database for profile default
  */
 public function createDbAction()
 {
     $config = DC::getDatabaseConfig('profiles/default');
     DatabaseService::configProfile(array('user' => $config['user'], 'pass' => $config['pass']));
     DBOperator::getInstance()->createDB($config['name']);
     $this->notify($config['name'], '+Database created:');
 }