@@ -89,12 +89,12 @@ public function generateForm()
8989 $ output = '' ;
9090
9191 foreach ($ this ->getTableColumns () as $ column ) {
92- $ name = $ column-> getName () ;
92+ $ name = $ column[ ' name ' ] ;
9393 if (in_array ($ name , $ reservedColumns )) {
9494 continue ;
9595 }
96- $ type = $ column -> getType ()-> getName ();
97- $ default = $ column-> getDefault () ;
96+
97+ [ ' type ' => $ type , ' default ' => $ default ] = $ column ;
9898
9999 $ defaultValue = '' ;
100100
@@ -172,7 +172,7 @@ public function generateShow()
172172 $ output = '' ;
173173
174174 foreach ($ this ->getTableColumns () as $ column ) {
175- $ name = $ column-> getName () ;
175+ $ name = $ column[ ' name ' ] ;
176176
177177 // set column label
178178 $ label = $ this ->formatLabel ($ name );
@@ -190,7 +190,7 @@ public function generateGrid()
190190 $ output = '' ;
191191
192192 foreach ($ this ->getTableColumns () as $ column ) {
193- $ name = $ column-> getName () ;
193+ $ name = $ column[ ' name ' ] ;
194194 $ label = $ this ->formatLabel ($ name );
195195
196196 $ output .= sprintf ($ this ->formats ['grid_column ' ], $ name , $ label );
@@ -215,35 +215,15 @@ protected function getReservedColumns()
215215 *
216216 * @throws \Exception
217217 *
218- * @return \Doctrine\DBAL\Schema\Column[]
218+ * @return list<array{name: string, type: string, type_name: string, nullable: bool, default: mixed, auto_increment: bool, comment: string|null, generation: array{type: string, expression: string|null}|null}>
219219 */
220220 protected function getTableColumns ()
221221 {
222- if (!$ this ->model ->getConnection ()->isDoctrineAvailable ()) {
223- throw new \Exception (
224- 'You need to require doctrine/dbal: ~2.3 in your own composer.json to get database columns. '
225- );
226- }
227-
228- $ table = $ this ->model ->getConnection ()->getTablePrefix () . $ this ->model ->getTable ();
229- /** @var \Doctrine\DBAL\Schema\MySqlSchemaManager $schema */
230- $ schema = $ this ->model ->getConnection ()->getDoctrineSchemaManager ($ table );
231-
232- // custom mapping the types that doctrine/dbal does not support
233- $ databasePlatform = $ schema ->getDatabasePlatform ();
222+ $ schema = $ this ->model ->getConnection ()->getSchemaBuilder ();
234223
235- foreach ($ this ->doctrineTypeMapping as $ doctrineType => $ dbTypes ) {
236- foreach ($ dbTypes as $ dbType ) {
237- $ databasePlatform ->registerDoctrineTypeMapping ($ dbType , $ doctrineType );
238- }
239- }
240-
241- $ database = null ;
242- if (strpos ($ table , '. ' )) {
243- list ($ database , $ table ) = explode ('. ' , $ table );
244- }
224+ $ table = $ this ->model ->getTable ();
245225
246- return $ schema ->listTableColumns ($ table, $ database );
226+ return $ schema ->getColumns ($ table );
247227 }
248228
249229 /**
0 commit comments