Changeset 3930

Show
Ignore:
Timestamp:
03/05/08 11:20:40 (16 months ago)
Author:
romanb
Message:

Fixed #786.

Location:
branches/0.10
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • branches/0.10/lib/Doctrine/Hydrator/RecordDriver.php

    r3884 r3930  
    2121 
    2222/** 
    23  * Doctrine_Hydrate_Record  
    24  * defines a record fetching strategy for Doctrine_Hydrate 
     23 * Doctrine_Hydrate_RecordDriver 
     24 * Hydration strategy used for creating collections of entity objects. 
    2525 * 
    2626 * @package     Doctrine 
     
    3131 * @version     $Revision$ 
    3232 * @author      Konsta Vesterinen <kvesteri@cc.hut.fi> 
     33 * @author      Roman Borschel <roman@code-factory.org> 
    3334 */ 
    3435class Doctrine_Hydrator_RecordDriver extends Doctrine_Locator_Injectable 
    3536{ 
    3637    protected $_collections = array(); 
    37      
    38     protected $_records = array(); 
    39      
    4038    protected $_tables = array(); 
    4139 
     
    8179     * @return boolean 
    8280     */ 
    83     public function isIdentifiable(array $row, Doctrine_Table $table) 
     81    /*public function isIdentifiable(array $row, Doctrine_Table $table) 
    8482    { 
    8583        $primaryKeys = $table->getIdentifierColumnNames(); 
     
    9795        } 
    9896        return true; 
    99     } 
     97    }*/ 
    10098     
    10199    public function getNullPointer()  
     
    114112        $record = $this->_tables[$component]->getRecord(); 
    115113 
    116         if ( ! isset($this->_records[$record->getOid()]) ) { 
    117             $record->clearRelated(); 
    118             $this->_records[$record->getOid()] = $record; 
    119         } 
    120  
    121114        return $record; 
    122115    } 
  • branches/0.10/lib/Doctrine/Record.php

    r3907 r3930  
    679679            } 
    680680            $query->where(implode(' = ? AND ', $this->getTable()->getIdentifierColumnNames()) . ' = ?'); 
     681            $this->clearRelated(); 
    681682            $record = $query->fetchOne($id); 
    682683        } else { 
  • branches/0.10/tests/RecordTestCase.php

    r3884 r3930  
    766766        $user = $this->objTable->find(5); 
    767767        $this->assertEqual($user->Group->count(), 3); 
    768         $this->assertEqual($user->Group[1]->id, 2); 
    769         $this->assertEqual($user->Group[2]->id, 3); 
     768        $this->assertEqual($user->Group[1]->id, 1); 
     769        $this->assertEqual($user->Group[2]->id, 2); 
    770770 
    771771        $user->unlink('Group', array($group1->id, $group2->id)); 
     
    792792        $user = $this->objTable->find(5); 
    793793        $this->assertEqual($user->Group->count(), 2); 
    794         $this->assertEqual($user->Group[0]->identifier(), $group1->identifier()); 
    795         $this->assertEqual($user->Group[1]->identifier(), $group2->identifier()); 
     794        $this->assertEqual($user->Group[0]->identifier(), $group2->identifier()); 
     795        $this->assertEqual($user->Group[1]->identifier(), $group1->identifier()); 
    796796 
    797797        $user->unlink('Group'); 
    798798        $user->save(); 
    799         unset($user); 
     799        $user->free(); 
    800800 
    801801        $user = $this->objTable->find(5); 
  • branches/0.10/tests/Ticket/428TestCase.php

    r3884 r3930  
    1414class Doctrine_Ticket_428_TestCase extends Doctrine_UnitTestCase 
    1515{ 
     16    private $_albums; 
     17     
    1618    public function prepareData() 
    1719    { 
     
    3133        $albums->save(); 
    3234        $this->assertEqual(count($albums[0]->Song), 4); 
     35        $this->_albums = $albums; 
    3336    } 
    3437 
    3538    public function testAggregateValueMappingSupportsLeftJoins()  
    3639    { 
     40        foreach ($this->_albums as $album) { 
     41            $album->clearRelated(); 
     42        } 
     43         
    3744        $q = new Doctrine_Query(); 
    3845