Commit 60136a4b authored by zYne's avatar zYne

--no commit message

--no commit message
parent 134c944b
...@@ -142,25 +142,23 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module ...@@ -142,25 +142,23 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module
{ {
$saveLater = array(); $saveLater = array();
foreach ($record->getReferences() as $k => $v) { foreach ($record->getReferences() as $k => $v) {
$fk = $record->getTable()->getRelation($k); $rel = $record->getTable()->getRelation($k);
if ($fk instanceof Doctrine_Relation_ForeignKey ||
$fk instanceof Doctrine_Relation_LocalKey) { if ($rel instanceof Doctrine_Relation_ForeignKey ||
$local = $fk->getLocal(); $rel instanceof Doctrine_Relation_LocalKey) {
$foreign = $fk->getForeign(); $local = $rel->getLocal();
$foreign = $rel->getForeign();
if ($record->getTable()->hasPrimaryKey($fk->getLocal())) { if ($record->getTable()->hasPrimaryKey($rel->getLocal())) {
if ( ! $record->exists()) { if ( ! $record->exists()) {
$saveLater[$k] = $fk; $saveLater[$k] = $rel;
} else { } else {
$v->save($this->conn); $v->save($this->conn);
} }
} else { } else {
// ONE-TO-ONE relationship // ONE-TO-ONE relationship
$obj = $record->get($fk->getAlias()); $obj = $record->get($rel->getAlias());
$obj->save($this->conn);
if ($obj->exists()) {
$obj->save($this->conn);
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment