Пример #1
0
 public function hasDefaultValue()
 {
     if ($this->Null == 'YES') {
         return true;
     }
     return !MormUtils::isEmpty($this->Default);
 }
Пример #2
0
 protected function fillOtherValues($instance)
 {
     $tabledesc = $instance->getTableDesc();
     $fields = $tabledesc->getFields();
     foreach ($fields as $field_name => $field) {
         $value = NULL;
         if (!$field->hasDefaultValue() && MormUtils::isEmpty($instance->{$field_name})) {
             if ($field->type == 'enum' || $field->type == 'set') {
                 // random is much funny
                 $value = $field->values[rand(0, count($field->values) - 1)];
             } elseif ($field->php_type == 'string') {
                 $value = md5(rand(0, 10000));
             } elseif ($field->isNumeric() && !$field->isAutoIncrement()) {
                 $value = rand();
             }
             $instance->{$field_name} = $value;
         }
     }
 }
Пример #3
0
 /**
  * @todo replace all call by MormUtils::isEmpty
  */
 private function isEmpty($val)
 {
     return MormUtils::isEmpty($val);
 }