예제 #1
0
 public static function resetMongo()
 {
     MongoDbConnector::getInstance()->getDatabase("yiid")->drop();
     MongoDbConnector::getInstance()->getDatabase("yiid_stats")->drop();
 }
예제 #2
0
 public static function getMongoCollection()
 {
     return MongoDbConnector::getInstance()->getCollection(sfConfig::get('app_mongodb_database_name_stats'), self::MONGO_COLLECTION_NAME);
 }
예제 #3
0
 /**
  *
  */
 protected function executeDbTasks($arguments = array(), $options = array())
 {
     $this->logSection('yiid', 'run db tasks');
     // new options array
     $opts = array();
     $env = $opts['env'] = $options['env'];
     // new arguments array
     $args = array();
     if ($options['no-confirmation']) {
         $args[] = '--no-confirmation';
     }
     // generate arguments array
     if ($env == 'dev' || $env == 'staging') {
         // add arguments for the "dev" or "staging" environment
         $args[] = '--all';
         // check if "confirmation" is enabled
         $args[] = '--and-load';
     } elseif ($env == 'prod') {
         // add arguments for the "prod" environment
         $args[] = '--all-classes';
         // $args[] = '--and-migrate';
     } else {
         throw new sfException(sprintf('Module "%s" does not exist.', $env));
     }
     // run doctrine build task
     $this->runTask('doctrine:build', $args, array('env' => $opts['env']));
     // clean up models folder
     $this->runTask('doctrine:clean', array("--no-confirmation"));
     // initialize mongo objects
     if ($env == 'dev' || $env == 'staging') {
         if ($options['no-confirmation'] || "y" == $this->ask("Mongo auf dem " . $env . '-System plattmachen? (host: ' . sfConfig::get('app_mongodb_host') . ' collection: ' . sfConfig::get('app_mongodb_database_name') . ") (y/N)")) {
             $this->logSection('mongo tasks', 'i am the mongo killer! now killing:');
             $this->logSection('mongo tasks', '(host: ' . sfConfig::get('app_mongodb_host') . ' collection: ' . sfConfig::get('app_mongodb_database_name') . ')');
             MongoDbConnector::getInstance()->getDatabase(sfConfig::get('app_mongodb_database_name'))->drop();
             $this->logSection('mongo tasks', ' (host: ' . sfConfig::get('app_mongodb_host') . ' collection: ' . sfConfig::get('app_mongodb_database_name_stats') . ')');
             MongoDbConnector::getInstance()->getDatabase(sfConfig::get('app_mongodb_database_name_stats'))->drop();
             $this->runTask('yiid:activity-testdata', array(), array('env' => $opts['env']));
             //$this->getFilesystem()->execute("php data/fixtures/initializeMongoObjects.php");
         }
     }
     $this->runTask('cc');
 }
예제 #4
0
 public static function getMongoCollection($pCollection)
 {
     return MongoDbConnector::getInstance()->getCollection(sfConfig::get('app_mongodb_database_name_stats'), $pCollection);
 }