Dmitry Ermichev
Dmitry Ermichev

Reputation: 423

yii2 check database type (mysql or oracle)

In my project I want to make utility class for different databases (MySQL, Oracle). How can I determine what db type is using in current \Yii::$app->db object?

Upvotes: 0

Views: 444

Answers (1)

Bizley
Bizley

Reputation: 18021

You can call

Yii::$app->db->getDriverName();

to get the name of the current DB driver.

Upvotes: 1

Related Questions