This commit is contained in:
parent
b8c2005b71
commit
8faf31e3ae
@ -223,10 +223,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
|
||||
foreach ((array) $options['foreignKeys'] as $k => $definition) {
|
||||
if (is_array($definition)) {
|
||||
if ( ! isset($definition['table'])) {
|
||||
$definition['table'] = $name;
|
||||
}
|
||||
$sql[] = $this->createForeignKeySql($definition['table'], $definition);
|
||||
$sql[] = $this->createForeignKeySql($name, $definition);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -868,6 +865,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
if ( ! is_array($definition['foreign'])) {
|
||||
$definition['foreign'] = array($definition['foreign']);
|
||||
}
|
||||
|
||||
$sql .= implode(', ', array_map(array($this->conn, 'quoteIdentifier'), $definition['local']))
|
||||
. ') REFERENCES '
|
||||
. $definition['foreignTable'] . '('
|
||||
@ -1007,7 +1005,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
} else {
|
||||
$sql[] = $query;
|
||||
}
|
||||
|
||||
|
||||
if (isset($data['options']['foreignKeys']) && is_array($data['options']['foreignKeys'])) {
|
||||
$fks[$table->getTableName()] = $data['options']['foreignKeys'];
|
||||
}
|
||||
|
@ -166,10 +166,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export
|
||||
|
||||
foreach ((array) $options['foreignKeys'] as $k => $definition) {
|
||||
if (is_array($definition)) {
|
||||
if ( ! isset($definition['table'])) {
|
||||
$definition['table'] = $name;
|
||||
}
|
||||
$sql[] = $this->createForeignKeySql($definition['table'], $definition);
|
||||
$sql[] = $this->createForeignKeySql($name, $definition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -382,9 +382,8 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
$relation->hasConstraint()) {
|
||||
|
||||
$def = array('local' => $relation->getLocal(),
|
||||
'table' => $relation->getTable()->getTableName(),
|
||||
'foreign' => $this->getIdentifier(),
|
||||
'foreignTable' => $this->getTableName());
|
||||
'foreignTable' => $relation->getTable()->getTableName());
|
||||
|
||||
if (($key = array_search($def, $options['foreignKeys'])) === false) {
|
||||
$options['foreignKeys'][] = $def;
|
||||
@ -402,9 +401,8 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
|
||||
$relation->getForeign() !== $relation->getTable()->getIdentifier()) {
|
||||
|
||||
$def = array('local' => $relation->getLocal(),
|
||||
'table' => $relation->getTable()->getTableName(),
|
||||
'foreign' => $this->getIdentifier(),
|
||||
'foreignTable' => $this->getTableName());
|
||||
'foreignTable' => $relation->getTable()->getTableName());
|
||||
|
||||
if (($key = array_search($def, $options['foreignKeys'])) === false) {
|
||||
$options['foreignKeys'][] = $def;
|
||||
|
Loading…
Reference in New Issue
Block a user