Changeset 4341

Show
Ignore:
Timestamp:
05/07/08 10:44:29 (14 months ago)
Author:
romanb
Message:

Fixed #540.

Location:
branches/0.11
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • branches/0.11/lib/Doctrine/Connection/UnitOfWork.php

    r4296 r4341  
    476476        foreach ($tree as $name) { 
    477477            $table = $this->conn->getTable($name); 
    478  
    479478            foreach ($table->getRepository() as $record) { 
    480                 $this->save($record); 
    481             } 
    482         } 
    483  
    484         // save all associations 
    485         foreach ($tree as $name) { 
    486             $table = $this->conn->getTable($name); 
    487  
    488             foreach ($table->getRepository() as $record) { 
    489                 $this->saveAssociations($record); 
     479                $this->saveGraph($record); 
    490480            } 
    491481        } 
  • branches/0.11/lib/Doctrine/Hydrator/RecordDriver.php

    r4337 r4341  
    7070        $this->_collections[] = $coll; 
    7171    } 
    72  
    73     /** 
    74      * isIdentifiable 
    75      * returns whether or not a given data row is identifiable (it contains 
    76      * all primary key fields specified in the second argument) 
    77      * 
    78      * @param array $row 
    79      * @param Doctrine_Table $table 
    80      * @return boolean 
    81      */ 
    82     /*public function isIdentifiable(array $row, Doctrine_Table $table) 
    83     { 
    84         $primaryKeys = $table->getIdentifierColumnNames(); 
    85  
    86         if (is_array($primaryKeys)) { 
    87             foreach ($primaryKeys as $id) { 
    88                 if ( ! isset($row[$id])) { 
    89                     return false; 
    90                 } 
    91             } 
    92         } else { 
    93             if ( ! isset($row[$primaryKeys])) { 
    94                 return false; 
    95             } 
    96         } 
    97         return true; 
    98     }*/ 
    9972     
    10073    public function getNullPointer()  
  • branches/0.11/tests/CustomResultSetOrderTestCase.php

    r3884 r4341  
    4242     */ 
    4343    public function prepareData() { 
     44        $this->connection->clear(); 
    4445        $cat1 = new CategoryWithPosition(); 
    4546        $cat1->position = 0; 
  • branches/0.11/tests/Query/ReferenceModelTestCase.php

    r3884 r4341  
    4646 
    4747    public function testInitializeData() { 
     48        $this->connection->clear(); 
    4849        $query = new Doctrine_Query($this->connection); 
    4950 
  • branches/0.11/tests/RecordTestCase.php

    r4294 r4341  
    4747    public function testOne2OneForeign() 
    4848    { 
     49        $this->conn->clear(); 
    4950        $user = new User(); 
    5051        $user->name = "Richard Linklater"; 
     
    336337    public function testManyToManyTreeStructure() 
    337338    { 
    338  
     339        $this->conn->clear(); 
    339340        $task = $this->connection->create("Task"); 
    340341 
     
    413414    public function testTreeStructure() 
    414415    { 
     416        $this->conn->clear(); 
    415417        $e = new Element(); 
    416418 
  • branches/0.11/tests/Relation/AccessTestCase.php

    r4029 r4341  
    22class Doctrine_Relation_Access_TestCase extends Doctrine_UnitTestCase { 
    33    public function prepareData() { 
     4        $this->conn->clear(); 
    45        $o1 = new File_Owner(); 
    56        $o1->name = "owner1"; 
     
    107108 
    108109        $this->assertTrue(isset($owner1->Data_File)); 
    109         $this->assertFalse(isset($owner2->Data_File)); 
    110         $this->assertEqual(1, $check->get('id')); 
    111         $this->assertEqual(1, $owner1->get('id')); 
     110        $this->assertFalse(isset($owner2->Data_File));; 
     111        $this->assertIdentical($check, $owner1); 
    112112        $this->assertEqual($owner1->get('id'), $check->get('id')); 
    113         $this->assertEqual(2, $owner2->get('id')); 
    114  
    115113    } 
    116114 
     
    134132        $this->assertTrue(isset($file1->File_Owner)); 
    135133        $this->assertFalse(isset($file2->File_Owner)); 
    136         $this->assertEqual(4, $check->get('id')); 
    137         $this->assertEqual(4, $file1->get('id')); 
     134        $this->assertIdentical($check, $file1); 
    138135        $this->assertEqual($file1->get('id'), $check->get('id')); 
    139         $this->assertEqual(1, $file2->get('id')); 
    140  
    141136    } 
    142137 
  • branches/0.11/tests/ValidatorTestCase.php

    r4240 r4341  
    477477        $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_NONE); 
    478478    } 
     479     
     480    public function testValidationIsTriggeredOnFlush() 
     481    { 
     482        $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_ALL); 
     483        $this->conn->clear(); 
     484 
     485        $r = new ValidatorTest_Person(); 
     486        $r->identifier = '5678'; 
     487        $r->save(); 
     488 
     489        $r = new ValidatorTest_Person(); 
     490        $r->identifier = 5678; 
     491        try { 
     492            $this->conn->flush(); 
     493            $this->fail("No validator exception thrown on unique validation, triggered by flush()."); 
     494        } catch (Doctrine_Validator_Exception $e) { 
     495            $this->pass(); 
     496        } 
     497         
     498        $this->manager->setAttribute(Doctrine::ATTR_VALIDATE, Doctrine::VALIDATE_NONE); 
     499    } 
    479500}