Issue Details (XML | Word | Printable)

Key: DBAL-26
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Benjamin Eberlei
Reporter: Jakub Husák
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Doctrine DBAL

DateTime type column can't be nullable

Created: 27/Jun/10 11:36 AM   Updated: 27/Jun/10 01:05 PM
Component/s: None
Affects Version/s: 2.0.0-BETA2
Fix Version/s: 2.0.0-BETA3


 Description  « Hide
After upgrade from B1 to B2 my app stopped working, throwing ConversionException on nullable DateTime field, value of which is null.
There is part of DateTimeType.php which causes it - if (!$val) matches even the valid null value.

public function convertToPHPValue($value, AbstractPlatform $platform)
{
$val = ($value !== null)
? \DateTime::createFromFormat($platform->getDateTimeFormatString(), $value) : null;
if (!$val) { throw ConversionException::conversionFailed($value, $this->getName()); }
return $val;
}



 All   Comments   Change History   FishEye      Sort Order: Ascending order - Click to sort in descending order
Jakub Husák added a comment - 27/Jun/10 11:41 AM
maybe there should be a null check in _gatherRowData method, before the value is passed to convertToPHPValue of any type class

Benjamin Eberlei added a comment - 27/Jun/10 12:21 PM
This is a bug in the ConversionException code, sorry for that i will fix it tonight.

Btw, you are not using Beta2 but trunk, the ConversionException code was just committed yesterday. Additionally you should use the ORM with the Beta2 not with trunk of DBAL, they don't work together currently in some aspects (SchemaTool)


Benjamin Eberlei added a comment - 27/Jun/10 01:05 PM
This was introduced with DBAL-22 and is now fixed