Since a while checking a connection to a database in a controller was working fine doing the following:
$em->getConnection()->connect();
$connected = $em->getConnection()->isConnected();
But I now have a deprecation:
php.INFO: User Deprecated: Public access to Connection::connect() is deprecated.
How should I test my database connection now ?
There is now a deprecation notice when connection is used outside the library:
You need to use
getNativeConnection()
instead (which is from the same Connection class)You can read the PR containing those changes.