@@ -156,9 +156,6 @@ public function generate()
156
156
*/
157
157
protected function getPropertiesFromTable ()
158
158
{
159
- $ properties = $ this ->reflection ->getDefaultProperties ();
160
-
161
- $ dateFormat = empty ($ properties ['dateFormat ' ]) ? $ this ->app ->config ->get ('database.datetime_format ' ) : $ properties ['dateFormat ' ];
162
159
try {
163
160
$ query = $ this ->model ->db ();
164
161
if ($ query instanceof Query) {
@@ -169,20 +166,21 @@ protected function getPropertiesFromTable()
169
166
}
170
167
171
168
if (!empty ($ fields )) {
172
- foreach ( $ fields as $ name => $ field ) {
173
- if ( in_array ( $ name , ( array ) $ properties [ ' disuse ' ])) {
174
- continue ;
175
- }
169
+ $ dateFormat = $ this -> model -> getOption ( ' dateFormat ' );
170
+ $ createTime = $ this -> model -> getOption ( ' createTime ' );
171
+ $ updateTime = $ this -> model -> getOption ( ' updateTime ' ) ;
172
+ $ fieldType = $ this -> model -> getOption ( ' type ' );
176
173
177
- if (in_array ($ name , [$ properties ['createTime ' ], $ properties ['updateTime ' ]])) {
174
+ foreach ($ fields as $ name => $ field ) {
175
+ if (in_array ($ name , [$ createTime , $ updateTime ])) {
178
176
if (false !== strpos ($ dateFormat , '\\' )) {
179
177
$ type = $ dateFormat ;
180
178
} else {
181
179
$ type = 'string ' ;
182
180
}
183
- } elseif (!empty ($ properties [ ' type ' ] [$ name ])) {
181
+ } elseif (!empty ($ fieldType [$ name ])) {
184
182
185
- $ type = $ properties [ ' type ' ] [$ name ];
183
+ $ type = $ fieldType [$ name ];
186
184
187
185
if (is_array ($ type )) {
188
186
[$ type , $ param ] = $ type ;
0 commit comments