@@ -83,25 +83,18 @@ protected function loadSchema(): void
83
83
$ schemaTool = new SchemaTool ($ this ->entityManager );
84
84
$ metadata = $ this ->entityManager ->getMetadataFactory ()->getAllMetadata ();
85
85
86
- // Create all tables at once to handle dependencies properly
87
- try {
88
- $ schemaTool ->createSchema ($ metadata );
89
- } catch (ToolsException $ e ) {
90
- // If creating all tables at once fails, try to create them one by one
91
- // This is a fallback mechanism
92
- $ connection = $ this ->entityManager ->getConnection ();
93
- $ schemaManager = $ connection ->createSchemaManager ();
86
+ $ connection = $ this ->entityManager ->getConnection ();
87
+ $ schemaManager = $ connection ->createSchemaManager ();
94
88
95
- foreach ($ metadata as $ classMetadata ) {
96
- $ tableName = $ classMetadata ->getTableName ();
89
+ foreach ($ metadata as $ classMetadata ) {
90
+ $ tableName = $ classMetadata ->getTableName ();
97
91
98
- if (!$ schemaManager ->tablesExist ([$ tableName ])) {
99
- try {
100
- $ schemaTool ->createSchema ([$ classMetadata ]);
101
- } catch (ToolsException $ e ) {
102
- // Log the error but continue with other tables
103
- echo $ e ->getMessage () . PHP_EOL ;
104
- }
92
+ if (!$ schemaManager ->tablesExist ([$ tableName ])) {
93
+ try {
94
+ $ schemaTool ->createSchema ([$ classMetadata ]);
95
+ } catch (ToolsException $ e ) {
96
+ // nothing to do
97
+ echo $ e ->getMessage ();
105
98
}
106
99
}
107
100
}
0 commit comments