Created
July 12, 2014 22:15
-
-
Save SDKiller/d8226e5a0bacc70d913c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function afterValidate() | |
{ | |
$schema = static::getTableSchema(); | |
foreach ($this->attributes as $attribute => $value) { | |
if (!$this->hasErrors($attribute)) { | |
$typecasted = $schema->getColumn($attribute)->phpTypecast($value); | |
if ($value !== $typecasted) { | |
$this->setAttribute($attribute, $typecasted); | |
} | |
} | |
} | |
return parent::afterValidate(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment