コード例 #1
0
ファイル: ColumnSchema.php プロジェクト: jwdeitch/components
 /**
  * {@inheritdoc}
  */
 protected function prepareDefault()
 {
     $defaultValue = parent::prepareDefault();
     if ($this->abstractType() == 'boolean') {
         $defaultValue = (int) $this->defaultValue;
     }
     return $defaultValue;
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 protected function prepareDefault()
 {
     if ($this->abstractType() == 'timestamp' && is_scalar($this->defaultValue)) {
         if (is_numeric($this->defaultValue)) {
             //Nothing to do
             return (int) $this->defaultValue;
         }
         $datetime = new \DateTime($this->defaultValue, new \DateTimeZone(DatabaseManager::DEFAULT_TIMEZONE));
         return $datetime->getTimestamp();
     }
     return parent::prepareDefault();
 }