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