This commit is contained in:
parent
e89a841b00
commit
87fa5b245f
@ -885,72 +885,6 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
||||
|
||||
}
|
||||
endswitch;
|
||||
|
||||
/**
|
||||
$coll = false;
|
||||
|
||||
if($fk instanceof Doctrine_ForeignKey ||
|
||||
$fk instanceof Doctrine_LocalKey) {
|
||||
|
||||
$graph = $table->getDQLParser();
|
||||
|
||||
// get the local identifier
|
||||
$id = $this->get($local);
|
||||
|
||||
if(empty($id)) {
|
||||
|
||||
$this->references[$name] = $table->create();
|
||||
|
||||
if($this->table->hasPrimaryKey($fk->getLocal())) {
|
||||
$this->references[$name]->set($fk->getForeign(),$this);
|
||||
} else {
|
||||
$this->set($fk->getLocal(),$this->references[$name]);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if($this->table->hasPrimaryKey($fk->getForeign())) {
|
||||
try {
|
||||
$coll = new Doctrine_Collection($table);
|
||||
|
||||
$coll[0] = $table->getCache()->fetch($id);
|
||||
|
||||
} catch(InvalidKeyException $e) {
|
||||
$coll = false;
|
||||
}
|
||||
}
|
||||
|
||||
if( ! $coll) {
|
||||
$query = "FROM ".$name." WHERE ".$name.".".$fk->getForeign()." = ?";
|
||||
$coll = $graph->query($query,array($id));
|
||||
}
|
||||
|
||||
if($fk->getType() == Doctrine_Table::ONE_COMPOSITE ||
|
||||
$fk->getType() == Doctrine_Table::ONE_AGGREGATE) {
|
||||
|
||||
if($coll->contains(0)) {
|
||||
$this->references[$name] = $coll[0];
|
||||
$this->originals[$name] = clone $coll[0];
|
||||
|
||||
} else {
|
||||
$this->references[$name] = $table->create();
|
||||
if($this->table->hasPrimaryKey($fk->getLocal())) {
|
||||
|
||||
$this->references[$name]->set($fk->getForeign(),$this);
|
||||
} else {
|
||||
$this->set($fk->getLocal(),$this->references[$name]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->references[$name] = $coll;
|
||||
$this->references[$name]->setReference($this,$fk);
|
||||
|
||||
|
||||
$this->originals[$name] = clone $coll;
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
break;
|
||||
endswitch;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user