Esempio n. 1
0
 /**
  * Add foreign keys
  * @param string $tableDslString [description]
  * @param CTable $tbl            [description]
  * @param CDialectBase $tables         [description]
  * @param string[] $nullablecols   [description]
  * @param string[] $uniquecols     [description]
  */
 private function addForeignKeys(&$tableDslString, $tbl, $tables, $nullablecols, $uniquecols)
 {
     $tblName = $tbl->getName();
     foreach ($tbl->getForeignKeys() as $fk) {
         $rel = in_array($fk->getColumnName(), $nullablecols) ? "0..*-0..1" : "0..*-1";
         $rel = in_array($fk->getColumnName(), $uniquecols) ? "0..1-1" : $rel;
         if (!isset($tables[$fk->getForeignTableName()])) {
             throw new \Exception("table not found");
         }
         $tableDslString .= "\n[{$tblName}]" . $rel . $this->generateTableDslRecursive($tables, $tables[$fk->getForeignTableName()]);
     }
 }