1
0
mirror of synced 2024-12-13 14:56:01 +03:00
This commit is contained in:
zYne 2007-06-20 14:12:31 +00:00
parent b8c2005b71
commit 8faf31e3ae
3 changed files with 6 additions and 13 deletions

View File

@ -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'];
}

View File

@ -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);
}
}
}

View File

@ -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;