Exemplo n.º 1
0
 public function getTableName()
 {
     $model = $this->getModel();
     $tableFactory = new Garp_Spawn_MySql_Table_Factory($model);
     $table = $tableFactory->produceConfigTable();
     return $table->name;
 }
Exemplo n.º 2
0
 /**
  * @param   Garp_Spawn_Model_Abstract       $model
  */
 public function __construct(Garp_Spawn_Model_Abstract $model, Garp_Cli_Ui_Protocol $feedback)
 {
     $tableFactory = new Garp_Spawn_MySql_Table_Factory($model);
     $configTable = $tableFactory->produceConfigTable();
     $liveTable = $tableFactory->produceLiveTable();
     $this->setSource($configTable);
     $this->setTarget($liveTable);
     $this->setModel($model);
     $this->setFeedback($feedback);
 }
Exemplo n.º 3
0
 protected function _getOtherTableName($modelName)
 {
     $model = $this->_getModelFromModelName($modelName);
     if ($model->isMultilingual()) {
         return $this->_getTranslatedViewName($model);
     }
     $factory = new Garp_Spawn_MySql_Table_Factory($model);
     $table = $factory->produceConfigTable();
     return $table->name;
 }
Exemplo n.º 4
0
 protected function _getBindingModelTable()
 {
     $bindingModel = $this->getRelation()->getBindingModel();
     $tableFactory = new Garp_Spawn_MySql_Table_Factory($bindingModel);
     $table = $tableFactory->produceConfigTable();
     return $table;
 }
Exemplo n.º 5
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);
             }
     */
 }
Exemplo n.º 6
0
 protected function _createBindingModelTableIfNotExists(Garp_Spawn_Relation $relation)
 {
     $bindingModel = $relation->getBindingModel();
     $tableFactory = new Garp_Spawn_MySql_Table_Factory($bindingModel);
     $configTable = $tableFactory->produceConfigTable();
     $this->_createTableIfNotExists($configTable);
 }