/**
  * Build validate lines for scalar fields.
  *
  * @param ScalarField $field
  * @param string      $line_indent
  * @param array       $validator_lines
  */
 private function buildValidatePresenceLinesForScalarField(ScalarField $field, $line_indent, array &$validator_lines)
 {
     if ($field instanceof RequiredInterface && $field instanceof UniqueInterface) {
         if ($field->isRequired() && $field->isUnique()) {
             $validator_lines[] = $line_indent . $this->buildValidatePresenceAndUniquenessLine($field->getName(), $field->getUniquenessContext());
         } elseif ($field->isRequired()) {
             $validator_lines[] = $line_indent . $this->buildValidatePresenceLine($field->getName());
         } elseif ($field->isUnique()) {
             $validator_lines[] = $line_indent . $this->buildValidateUniquenessLine($field->getName(), $field->getUniquenessContext());
         }
     } elseif ($field instanceof RequiredInterface && $field->isRequired()) {
         $validator_lines[] = $line_indent . $this->buildValidatePresenceLine($field->getName());
     } elseif ($field instanceof UniqueInterface && $field->isUnique()) {
         $validator_lines[] = $line_indent . $this->buildValidateUniquenessLine($field->getName(), $field->getUniquenessContext());
     }
 }
 /**
  * @param string $name
  * @param bool   $default_value
  */
 public function __construct($name, $default_value = false)
 {
     parent::__construct($name, $default_value);
 }
 /**
  * Prepare default value.
  *
  * @param  ScalarField $field
  * @return string
  */
 public function prepareDefaultValue(ScalarField $field)
 {
     $default_value = $field->getDefaultValue();
     if ($default_value === null) {
         return 'NULL';
     }
     if ($field instanceof DateField || $field instanceof DateTimeField) {
         $timestamp = is_int($default_value) ? $default_value : strtotime($default_value);
         if ($field instanceof DateTimeField) {
             return $this->getConnection()->escapeValue(date('Y-m-d H:i:s', $timestamp));
         } else {
             return $this->getConnection()->escapeValue(date('Y-m-d', $timestamp));
         }
     }
     return $this->getConnection()->escapeValue($default_value);
 }