1
0
mirror of synced 2024-12-13 22:56:04 +03:00
This commit is contained in:
zYne 2007-09-06 20:38:22 +00:00
parent ec6120b955
commit 4eac440c56

View File

@ -300,7 +300,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
*/
public function get($key)
{
if ($key === null || ! isset($this->data[$key])) {
if ( ! isset($this->data[$key])) {
$record = $this->_table->create();
if (isset($this->referenceField)) {
@ -312,8 +312,11 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
$record->set($this->referenceField, $this->reference, false);
}
}
$this->data[] = $record;
if ($key === null) {
$this->data[] = $record;
} else {
$this->data[$key] = $record;
}
return $record;
}