Aggregate relations now treated the same ways as composite relations on save operations
This commit is contained in:
parent
dd5c9d0516
commit
0a5a3bcdfe
@ -144,25 +144,24 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module implemen
|
|||||||
$fk = $record->getTable()->getRelation($k);
|
$fk = $record->getTable()->getRelation($k);
|
||||||
if ($fk instanceof Doctrine_Relation_ForeignKey ||
|
if ($fk instanceof Doctrine_Relation_ForeignKey ||
|
||||||
$fk instanceof Doctrine_Relation_LocalKey) {
|
$fk instanceof Doctrine_Relation_LocalKey) {
|
||||||
if ($fk->isComposite()) {
|
$local = $fk->getLocal();
|
||||||
$local = $fk->getLocal();
|
$foreign = $fk->getForeign();
|
||||||
$foreign = $fk->getForeign();
|
|
||||||
|
|
||||||
if ($record->getTable()->hasPrimaryKey($fk->getLocal())) {
|
if ($record->getTable()->hasPrimaryKey($fk->getLocal())) {
|
||||||
if ( ! $record->exists()) {
|
if ( ! $record->exists()) {
|
||||||
$saveLater[$k] = $fk;
|
$saveLater[$k] = $fk;
|
||||||
} else {
|
|
||||||
$v->save();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// ONE-TO-ONE relationship
|
$v->save();
|
||||||
$obj = $record->get($fk->getTable()->getComponentName());
|
}
|
||||||
|
} else {
|
||||||
|
// ONE-TO-ONE relationship
|
||||||
|
$obj = $record->get($fk->getAlias());
|
||||||
|
|
||||||
if ($obj->getState() != Doctrine_Record::STATE_TCLEAN) {
|
if ($obj->getState() != Doctrine_Record::STATE_TCLEAN) {
|
||||||
$obj->save();
|
$obj->save();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} elseif ($fk instanceof Doctrine_Relation_Association) {
|
} elseif ($fk instanceof Doctrine_Relation_Association) {
|
||||||
$v->save();
|
$v->save();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user