fixed reference setting
This commit is contained in:
parent
796c53fc87
commit
01d8e55bd0
@ -232,7 +232,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
|||||||
|
|
||||||
$value = $record->get($relation->getLocal());
|
$value = $record->get($relation->getLocal());
|
||||||
|
|
||||||
foreach ($this->getNormalIterator() as $record) {
|
foreach ($this->data as $record) {
|
||||||
if ($value !== null) {
|
if ($value !== null) {
|
||||||
$record->set($this->referenceField, $value, false);
|
$record->set($this->referenceField, $value, false);
|
||||||
} else {
|
} else {
|
||||||
@ -300,8 +300,14 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
|||||||
$record = $this->_table->create();
|
$record = $this->_table->create();
|
||||||
|
|
||||||
if (isset($this->referenceField)) {
|
if (isset($this->referenceField)) {
|
||||||
|
$value = $this->reference->get($this->relation->getLocal());
|
||||||
|
|
||||||
|
if ($value !== null) {
|
||||||
|
$record->set($this->referenceField, $value, false);
|
||||||
|
} else {
|
||||||
$record->set($this->referenceField, $this->reference, false);
|
$record->set($this->referenceField, $this->reference, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->data[] = $record;
|
$this->data[] = $record;
|
||||||
|
|
||||||
@ -370,8 +376,14 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
|
|||||||
public function add(Doctrine_Record $record, $key = null)
|
public function add(Doctrine_Record $record, $key = null)
|
||||||
{
|
{
|
||||||
if (isset($this->referenceField)) {
|
if (isset($this->referenceField)) {
|
||||||
|
$value = $this->reference->get($this->relation->getLocal());
|
||||||
|
|
||||||
|
if ($value !== null) {
|
||||||
|
$record->set($this->referenceField, $value, false);
|
||||||
|
} else {
|
||||||
$record->set($this->referenceField, $this->reference, false);
|
$record->set($this->referenceField, $this->reference, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* for some weird reason in_array cannot be used here (php bug ?)
|
* for some weird reason in_array cannot be used here (php bug ?)
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user