|
@@ -162,7 +162,6 @@ DOC;
|
|
|
$dynamicProperty[$property] = $defaults[$property];
|
|
|
}
|
|
|
}
|
|
|
- if(count($dynamicProperty)) {
|
|
|
$classAndProperty[] = <<<DOC
|
|
|
/**
|
|
|
* 动态变化的日期,初始化的时候赋值
|
|
@@ -196,16 +195,17 @@ DOC;
|
|
|
$classAndProperty[] = "\t */";
|
|
|
$classAndProperty[] = "\tpublic function defaultFieldsValue(){";
|
|
|
$classAndProperty[] = "\t\t\$defaultValue = [];";
|
|
|
- foreach ($dynamicProperty as $property => $dynamic) {
|
|
|
- if($dynamic == 'CURRENT_TIMESTAMP') {
|
|
|
- $classAndProperty[] = "\t\t" . '$defaultValue[\''. $property ."'] = date('Y-m-d H:i:s');";
|
|
|
- }else{
|
|
|
- $classAndProperty[] = "\t\t" . '$defaultValue[\''. $property ."'] = '". str_replace("'", "\\'", $dynamic)."';";
|
|
|
+ if(count($dynamicProperty) > 0) {
|
|
|
+ foreach ($dynamicProperty as $property => $dynamic) {
|
|
|
+ if($dynamic == 'CURRENT_TIMESTAMP') {
|
|
|
+ $classAndProperty[] = "\t\t" . '$defaultValue[\''. $property ."'] = date('Y-m-d H:i:s');";
|
|
|
+ }else{
|
|
|
+ $classAndProperty[] = "\t\t" . '$defaultValue[\''. $property ."'] = '". str_replace("'", "\\'", $dynamic)."';";
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
$classAndProperty[] = "\t\treturn \$defaultValue;";
|
|
|
$classAndProperty[] = "\t}";
|
|
|
- }
|
|
|
//生成 table rules
|
|
|
$classAndProperty[] = $this->generateRules($tableInfo);
|
|
|
$classAndProperty[] = '}';
|