コード例 #1
0
ファイル: PgSynchronizer.php プロジェクト: rombar3/PgExplorer
 /**
  * @param $tableOid
  * @param $weight
  * @return string
  * @throws SyncException
  * @throws \rombar\PgExplorerBundle\Exceptions\ElementNotFoundException
  */
 private function syncTable($tableOid, Weight $weight)
 {
     $table = $this->fromAnalyzer->getTableByOid($tableOid);
     if ($this->isTableSynchronizable($table)) {
         $data = $this->getFromTableData($table);
         if (count($data) > 0) {
             $message = $this->insertData($table, $data);
         } else {
             $this->logger->addInfo('Table ' . $table->getSchema() . PgAnalyzer::DB_SEPARATOR . $table->getName() . ' is empty');
             $message = 'OK';
             //Nothing to do. Table is empty
         }
         if ($message == 'OK') {
             $weight->updateTableStatus($table->getOid(), true);
             return $message;
         } else {
             throw new SyncException('Table ' . $table->getSchema() . PgAnalyzer::DB_SEPARATOR . $table->getName() . ' not sync : ' . $message);
         }
     } else {
         $this->logger->addWarning('Table not Synchronizable (yet?) : ' . $table->getSchema() . PgAnalyzer::DB_SEPARATOR . $table->getName());
         return self::TABLE_NOT_SYNC;
     }
 }
コード例 #2
0
 /**
  * @param Weight $weight
  */
 public function setWeight(Weight $weight)
 {
     $this->weights[$weight->getWeight()] = $weight;
 }