has(DatabaseManager::class)) { $connection = $container->get(DatabaseManager::class)->getConnection(); } else { $databaseConfig = $container->get(DatabaseConfig::class); $timer = $container->get(Timer::class); // Create a simple database manager for connection only with minimal dependencies $databaseManager = new DatabaseManager( config: $databaseConfig, platform: $databaseConfig->driverConfig->platform, timer: $timer, migrationsPath: 'database/migrations' ); $connection = $databaseManager->getConnection(); } // Automatically wrap with AsyncAwareConnection if AsyncService is available if ($this->enableAsync && $this->asyncService !== null) { return new AsyncAwareConnection($connection, $this->asyncService); } return $connection; } }