Changeset 967 for branches/1.2

Show
Ignore:
Timestamp:
02/12/08 00:15:47 (9 months ago)
Author:
hans
Message:

Refs #558 - Applying patch from Joe for 0000-00-00 & MySQL

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.2/generator/classes/propel/engine/database/model/Domain.php

    r536 r967  
    247247                        return $this->booleanValue($this->defaultValue); 
    248248                } elseif ($this->propelType === PropelTypes::DATE || $this->propelType === PropelTypes::TIME || $this->propelType === PropelTypes::TIMESTAMP) { 
     249            // Under PHP 5.2.5, using '0000-00-00' as the default value will trigger an exception 
     250            // so instead of converting it to unix timestamp, we turn it into a null 
     251            if(preg_match('/^0000-00-00/', $this->defaultValue)) { 
     252                return null; 
     253            }  
    249254                        // DATE/TIME vals need to be converted to integer timestamp 
    250255                        $ts = strtotime($this->defaultValue);