Commit 0a5a3bcd authored by zYne's avatar zYne

Aggregate relations now treated the same ways as composite relations on save operations

parent dd5c9d05
......@@ -144,25 +144,24 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module implemen
$fk = $record->getTable()->getRelation($k);
if ($fk instanceof Doctrine_Relation_ForeignKey ||
$fk instanceof Doctrine_Relation_LocalKey) {
if ($fk->isComposite()) {
$local = $fk->getLocal();
$foreign = $fk->getForeign();
if ($record->getTable()->hasPrimaryKey($fk->getLocal())) {
if ( ! $record->exists()) {
$saveLater[$k] = $fk;
} else {
$v->save();
}
$local = $fk->getLocal();
$foreign = $fk->getForeign();
if ($record->getTable()->hasPrimaryKey($fk->getLocal())) {
if ( ! $record->exists()) {
$saveLater[$k] = $fk;
} else {
// ONE-TO-ONE relationship
$obj = $record->get($fk->getTable()->getComponentName());
$v->save();
}
} else {
// ONE-TO-ONE relationship
$obj = $record->get($fk->getAlias());
if ($obj->getState() != Doctrine_Record::STATE_TCLEAN) {
$obj->save();
}
if ($obj->getState() != Doctrine_Record::STATE_TCLEAN) {
$obj->save();
}
}
} elseif ($fk instanceof Doctrine_Relation_Association) {
$v->save();
}
......
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