Skip to content

Instantly share code, notes, and snippets.

@kinncj
Created December 20, 2016 18:24
Show Gist options
  • Save kinncj/5b7596594ed9e5cab68987183582ae4d to your computer and use it in GitHub Desktop.
Save kinncj/5b7596594ed9e5cab68987183582ae4d to your computer and use it in GitHub Desktop.
questão do joubertredrat no PHPSP - Slack
<?php
SuaPlatform extends MySQLWHateverPlatform
{
/** .. **/
public function getDefaultValueDeclarationSQL($field)
{
$default = parent::getDefaultValueDeclarationSQL($field);
$this->decorateDatetime($field, $default);
return $default;
}
private function isDatetime($field, &$default)
{
if (isset($field['type']) && in_array((string) $field['type'], array('DateTime', 'DateTimeTz'))) {
$default = " DEFAULT " . $field['default'];
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment