-
Notifications
You must be signed in to change notification settings - Fork 443
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
cast of default column value CURRENT_TIMESTAMP in MysqlAdatper throws exception #2
Comments
I've applied this fix. thanks! |
Closed
joshuan
pushed a commit
to Fabrica/php-activerecord
that referenced
this issue
May 23, 2014
Shortened the false condition in PgsqlAdapter::boolean_to_string()
ghost
mentioned this issue
May 26, 2014
passthefist
pushed a commit
to passthefist/php-activerecord
that referenced
this issue
Jun 30, 2014
This issue was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When declaring a model for a table with a CURRENT_TIMESTAMP set as the default value, the MysqlAdapter throws an exception. Ideally one would not use CURRENT_TIMESTAMP on a database while using the ActiveRecord pattern but we all have the fun of working with legacy databases, especially since this is very new to PHP.
The Exception is thrown from DateTime::__construct =>
>> $a = new DateTime('CURRENT_TIMESTAMP');
Exception (code: 0) got thrown
exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (CURRENT_TIMESTAMP) at position 0 (C): The timezone could not be found in the database' in...
Possible Fix (mimics Rails which just returns nil on a bad time parse):
The text was updated successfully, but these errors were encountered: