Changeset 4770

Show
Ignore:
Timestamp:
08/13/08 06:11:04 (11 months ago)
Author:
guilhermeblanco
Message:

fixes #1305. When you try to assign a null value in a column that has notnull=true, it tries to assign the default value, preventing SQL error.
Updated ticket #923. It had incorrect call place in code.

Location:
branches/1.0
Files:
1 added
3 modified

Legend:

Unmodified
Added
Removed
  • branches/1.0/lib/Doctrine/Record.php

    r4769 r4770  
    941941            if ($this->_isValueModified($type, $old, $value)) { 
    942942                if ($value === null) { 
    943                     $value = self::$_null; 
     943                    $default = $this->_table->getDefaultValueOf($fieldName); 
     944                    $value = ($default === null) ? self::$_null : $default; 
    944945                } 
    945946 
     
    12541255            } 
    12551256        } 
     1257 
    12561258        $map = $this->_table->inheritanceMap; 
    12571259        foreach ($map as $k => $v) { 
  • branches/1.0/tests/run.php

    r4759 r4770  
    106106$tickets->addTestCase(new Doctrine_Ticket_1296_TestCase()); 
    107107$tickets->addTestCase(new Doctrine_Ticket_1304_TestCase()); 
     108$tickets->addTestCase(new Doctrine_Ticket_1305_TestCase()); 
    108109 
    109110$test->addTestCase($tickets); 
  • branches/1.0/tests/Ticket/923TestCase.php

    r4154 r4770  
    7777          ->offset(0) 
    7878          ->execute(); 
     79           
     80          $this->assertEqual($result->count(), 3); 
    7981        } catch (Exception $e) { 
    8082            $this->fail($e->getMessage()); 
    8183        } 
    82  
    83         $this->assertEqual($result->count(), 3); 
    8484    } 
    8585}