Commit ddf0ceab authored by zYne's avatar zYne

Doctrine_Collection::internalAdd() removed, fixes #129

Ticket: 129
parent 1a0179bd
...@@ -487,38 +487,6 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator ...@@ -487,38 +487,6 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
$this->data[$key] = $record; $this->data[$key] = $record;
} }
/**
* adds a record to collection
* @param Doctrine_Record $record record to be added
* @param string $key optional key for the record
* @return boolean
*/
public function internalAdd(Doctrine_Record $record,$key = null) {
if(in_array($record,$this->data))
return false;
if(isset($this->reference_field))
$record->set($this->reference_field, $this->reference, false);
if(isset($key)) {
if(isset($this->data[$key]))
return false;
$this->data[$key] = $record;
return true;
}
if(isset($this->keyColumn)) {
$value = $record->get($this->keyColumn);
if($value === null)
throw new Doctrine_Collection_Exception("Couldn't create collection index. Record field '".$this->keyColumn."' was null.");
$this->data[$value] = $record;
} else
$this->data[] = $record;
return true;
}
/** /**
* adds a record to collection * adds a record to collection
* @param Doctrine_Record $record record to be added * @param Doctrine_Record $record record to be added
......
...@@ -1188,8 +1188,8 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite ...@@ -1188,8 +1188,8 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
public function addReference(Doctrine_Record $record, Doctrine_Relation $connector, $key = null) { public function addReference(Doctrine_Record $record, Doctrine_Relation $connector, $key = null) {
$alias = $connector->getAlias(); $alias = $connector->getAlias();
$this->references[$alias]->internalAdd($record, $key); $this->references[$alias]->add($record, $key);
$this->originals[$alias]->internalAdd($record, $key); $this->originals[$alias]->add($record, $key);
} }
/** /**
* getReferences * getReferences
......
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