diff --git a/lib/Doctrine/Collection.php b/lib/Doctrine/Collection.php index 22a13757e..e638ffa68 100644 --- a/lib/Doctrine/Collection.php +++ b/lib/Doctrine/Collection.php @@ -487,38 +487,6 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator $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 * @param Doctrine_Record $record record to be added diff --git a/lib/Doctrine/Record.php b/lib/Doctrine/Record.php index 95332e612..feac54df1 100644 --- a/lib/Doctrine/Record.php +++ b/lib/Doctrine/Record.php @@ -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) { $alias = $connector->getAlias(); - $this->references[$alias]->internalAdd($record, $key); - $this->originals[$alias]->internalAdd($record, $key); + $this->references[$alias]->add($record, $key); + $this->originals[$alias]->add($record, $key); } /** * getReferences