parent
ddf0ceab82
commit
753e9bd4cc
@ -96,7 +96,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
|||||||
* getTable
|
* getTable
|
||||||
* returns the table this collection belongs to
|
* returns the table this collection belongs to
|
||||||
*
|
*
|
||||||
* @return object Doctrine_Table
|
* @return Doctrine_Table
|
||||||
*/
|
*/
|
||||||
public function getTable() {
|
public function getTable() {
|
||||||
return $this->table;
|
return $this->table;
|
||||||
|
@ -417,7 +417,7 @@ abstract class Doctrine_Hydrate extends Doctrine_Access {
|
|||||||
if($fk instanceof Doctrine_LocalKey)
|
if($fk instanceof Doctrine_LocalKey)
|
||||||
$last->set($fk->getLocal(), $record->getIncremented(), false);
|
$last->set($fk->getLocal(), $record->getIncremented(), false);
|
||||||
|
|
||||||
$last->initSingleReference($record, $fk);
|
$last->set($fk->getAlias(), $record);
|
||||||
|
|
||||||
$prev[$name] = $record;
|
$prev[$name] = $record;
|
||||||
break;
|
break;
|
||||||
@ -428,6 +428,8 @@ abstract class Doctrine_Hydrate extends Doctrine_Access {
|
|||||||
if( ! $last->hasReference($alias)) {
|
if( ! $last->hasReference($alias)) {
|
||||||
$prev[$name] = $this->getCollection($name);
|
$prev[$name] = $this->getCollection($name);
|
||||||
$last->initReference($prev[$name], $fk);
|
$last->initReference($prev[$name], $fk);
|
||||||
|
|
||||||
|
//$last->set($fk->getAlias(), $this->getCollection($name));
|
||||||
} else {
|
} else {
|
||||||
// previous entry found from identityMap
|
// previous entry found from identityMap
|
||||||
$prev[$name] = $last->get($alias);
|
$prev[$name] = $last->get($alias);
|
||||||
|
@ -741,6 +741,8 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
} catch(Doctrine_Table_Exception $e) {
|
} catch(Doctrine_Table_Exception $e) {
|
||||||
throw new Doctrine_Record_Exception("Unknown property / related component '$name'.");
|
throw new Doctrine_Record_Exception("Unknown property / related component '$name'.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// one-to-many or one-to-one relation
|
// one-to-many or one-to-one relation
|
||||||
if($rel instanceof Doctrine_ForeignKey ||
|
if($rel instanceof Doctrine_ForeignKey ||
|
||||||
$rel instanceof Doctrine_LocalKey) {
|
$rel instanceof Doctrine_LocalKey) {
|
||||||
@ -760,7 +762,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
throw new Doctrine_Record_Exception("Couldn't call Doctrine::set(), second argument should be an instance of Doctrine_Record when setting one-to-one references.");
|
throw new Doctrine_Record_Exception("Couldn't call Doctrine::set(), second argument should be an instance of Doctrine_Record when setting one-to-one references.");
|
||||||
|
|
||||||
if($rel->getLocal() == $this->table->getIdentifier()) {
|
if($rel->getLocal() == $this->table->getIdentifier()) {
|
||||||
$this->references[$name]->set($rel->getForeign(),$this);
|
$value->set($rel->getForeign(), $this, false);
|
||||||
} else {
|
} else {
|
||||||
$this->set($rel->getLocal(),$value);
|
$this->set($rel->getLocal(),$value);
|
||||||
}
|
}
|
||||||
@ -1151,18 +1153,6 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
|
|||||||
|
|
||||||
throw new Doctrine_Record_Exception("Unknown reference $name");
|
throw new Doctrine_Record_Exception("Unknown reference $name");
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* initalizes a one-to-one relation
|
|
||||||
*
|
|
||||||
* @param Doctrine_Record $record
|
|
||||||
* @param Doctrine_Relation $connector
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function initSingleReference(Doctrine_Record $record, Doctrine_Relation $connector) {
|
|
||||||
$alias = $connector->getAlias();
|
|
||||||
|
|
||||||
$this->references[$alias] = $record;
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* initalizes a one-to-many / many-to-many relation
|
* initalizes a one-to-many / many-to-many relation
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user