Example #1
0
 protected function _createTableIfNotExists()
 {
     $tableFactory = new Garp_Spawn_MySql_Table_Factory($this->getModel()->getI18nModel());
     $table = $tableFactory->produceConfigTable();
     if (!Garp_Spawn_MySql_Table_Base::exists($table->name)) {
         $table->create();
     } else {
         // Make sure an existing table is updated
         $baseSynchronizer = new Garp_Spawn_MySql_Table_Synchronizer($this->getModel()->getI18nModel(), $this->getFeedback());
         $baseSynchronizer->sync(false);
     }
     /*
             if (
        !Garp_Spawn_MySql_Table_Base::exists($table->name) &&
        !$table->create()
             ) {
        $error = sprintf(self::ERROR_CANT_CREATE_TABLE, $table->name);
        throw new Exception($error);
             }
     */
 }
Example #2
0
 protected function _createTableIfNotExists(Garp_Spawn_MySql_Table_Abstract $table)
 {
     if (!Garp_Spawn_MySql_Table_Base::exists($table->name)) {
         $progress = $this->_getFeedbackInstance();
         $progress->display($table->name . " table creation");
         if (!$table->create()) {
             $error = sprintf(self::ERROR_CANT_CREATE_TABLE, $table->name);
             throw new Exception($error);
         }
     }
 }