File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace Voice \JsonQueryBuilder \Config ;
4
4
5
+ use Doctrine \DBAL \DBALException ;
5
6
use Illuminate \Database \Eloquent \Model ;
6
7
use Illuminate \Support \Facades \Cache ;
7
8
use Illuminate \Support \Facades \Config ;
@@ -119,8 +120,12 @@ public function getModelColumns(): array
119
120
$ columns = Schema::getColumnListing ($ table );
120
121
$ modelColumns = [];
121
122
122
- foreach ($ columns as $ column ) {
123
- $ modelColumns [$ column ] = DB ::getSchemaBuilder ()->getColumnType ($ table , $ column );
123
+ try { // having 'enum' in table definition will throw Doctrine error because it is not defined in their types.
124
+ foreach ($ columns as $ column ) {
125
+ $ modelColumns [$ column ] = DB ::getSchemaBuilder ()->getColumnType ($ table , $ column );
126
+ }
127
+ } catch (DBALException $ e ) {
128
+ // leave model columns as an empty array and cache it.
124
129
}
125
130
126
131
Cache::put (self ::CACHE_PREFIX . $ table , $ modelColumns , self ::CACHE_TTL );
You can’t perform that action at this time.
0 commit comments