symfony 2.8.8如何检查框架连接到mysql(mariadb)

I am using Symfony 2.8.8. framework and am quite hooked onto it for developing my first web application. The symfony book is very useful. I am on the database and doctrine chapter.

The question I have is: Is there a simple way to know that the database is functional and symfony is able to connect to the database before writing the doctrine class files that generate the database/entities?

I am using the following environment:

PHP: 5.5.38 cli,
SYMFONY: 2.8.8,
DATABASE: mariadb 10.0.17 installed through XAMPP v5.6.23. launched using XAMPP control panel 3.2.2,
WEBSERVER: php internal web server with loading of php.ini file.
INI:php.ini uncommented extension=php_mysql.dll, extension=php_pdo_mysql.dll. Updated parameters.yml to point to hosted mariadb.Updated config.yml to use pdo_mysql driver
OS: windows 7

Try using this. I'm not sure if its the same for mariadb.

Create a controller and past this inside the controller.

$entityManager = $this->getEntityManager() ;

try {
$entityManager->getConnection()->connect();
} catch (\Exception $e) {
// failed to connect
}

[EDITED]

I did some research and it seems like getEntityManager(); is deprecated since 2.3

You can use

// Get the entity manager
   $em = $this->getDoctrine()->getManager();
// Connection will be written as
   $em = $this->getDoctrine()->getConnection();

Or

Check this documentation Doctrine connection