1
0
mirror of synced 2024-12-14 07:06:04 +03:00

Doctrine_Collection::internalAdd() removed, fixes #129

Ticket: 129
This commit is contained in:
zYne 2006-09-27 21:41:20 +00:00
parent 1a0179bdce
commit ddf0ceab82
2 changed files with 2 additions and 34 deletions

View File

@ -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

View File

@ -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