@@ 997-1012 (lines=16) @@ | ||
994 | * @param string $tableName Table name |
|
995 | * @return string |
|
996 | */ |
|
997 | protected function getForeignKeySqlDefinition(ForeignKey $foreignKey, $tableName) |
|
998 | { |
|
999 | $constraintName = $foreignKey->getConstraint() |
|
1000 | ? $foreignKey->getConstraint() |
|
1001 | : $tableName . '_' . implode('_', $foreignKey->getColumns()); |
|
1002 | ||
1003 | $def = ' CONSTRAINT "' . $constraintName . '" FOREIGN KEY ("' . implode('", "', $foreignKey->getColumns()) . '")'; |
|
1004 | $def .= " REFERENCES {$this->quoteTableName($foreignKey->getReferencedTable()->getName())} (\"" . implode('", "', $foreignKey->getReferencedColumns()) . '")'; |
|
1005 | if ($foreignKey->getOnDelete()) { |
|
1006 | $def .= " ON DELETE {$foreignKey->getOnDelete()}"; |
|
1007 | } |
|
1008 | if ($foreignKey->getOnUpdate()) { |
|
1009 | $def .= " ON UPDATE {$foreignKey->getOnUpdate()}"; |
|
1010 | } |
|
1011 | return $def; |
|
1012 | } |
|
1013 | ||
1014 | /** |
|
1015 | * {@inheritdoc} |
@@ 1088-1104 (lines=17) @@ | ||
1085 | * @param ForeignKey $foreignKey |
|
1086 | * @return string |
|
1087 | */ |
|
1088 | protected function getForeignKeySqlDefinition(ForeignKey $foreignKey, $tableName) |
|
1089 | { |
|
1090 | $constraintName = $foreignKey->getConstraint() |
|
1091 | ? $foreignKey->getConstraint() |
|
1092 | : $tableName . '_' . implode('_', $foreignKey->getColumns()); |
|
1093 | $def = ' CONSTRAINT ' . $this->quoteColumnName($constraintName); |
|
1094 | $def .= ' FOREIGN KEY ("' . implode('", "', $foreignKey->getColumns()) . '")'; |
|
1095 | $def .= " REFERENCES {$this->quoteTableName($foreignKey->getReferencedTable()->getName())} (\"" . implode('", "', $foreignKey->getReferencedColumns()) . '")'; |
|
1096 | if ($foreignKey->getOnDelete()) { |
|
1097 | $def .= " ON DELETE {$foreignKey->getOnDelete()}"; |
|
1098 | } |
|
1099 | if ($foreignKey->getOnUpdate()) { |
|
1100 | $def .= " ON UPDATE {$foreignKey->getOnUpdate()}"; |
|
1101 | } |
|
1102 | ||
1103 | return $def; |
|
1104 | } |
|
1105 | ||
1106 | /** |
|
1107 | * {@inheritdoc} |