Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DBAL-26: DateTime type column can't be nullable #1437

Closed
doctrinebot opened this issue Jun 27, 2010 · 5 comments
Closed

DBAL-26: DateTime type column can't be nullable #1437

doctrinebot opened this issue Jun 27, 2010 · 5 comments
Assignees
Labels
Milestone

Comments

@doctrinebot
Copy link

Jira issue originally created by user koubas:

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;
}
@doctrinebot
Copy link
Author

Comment created by koubas:

maybe there should be a null check in _gatherRowData method, before the value is passed to convertToPHPValue of any type class

@doctrinebot
Copy link
Author

Comment created by @beberlei:

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)

@doctrinebot
Copy link
Author

Comment created by @beberlei:

This was introduced with DBAL-22 and is now fixed

@doctrinebot
Copy link
Author

Issue was closed with resolution "Fixed"

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants