davedevelopment / phpmig

Simple migrations system for php
Other
569 stars 92 forks source link

added DBAL3 class for using with doctrine/dbal 3 version #154

Open dmnbars opened 2 years ago

dmnbars commented 2 years ago

adapter for doctrine dbal version 3.0 and above. this adapter is copy of Phpmig\Adapter\Doctrine\DBAL with fixed Connection methods calls. more info about changes in version 3 here: https://www.doctrine-project.org/2020/11/17/dbal-3.0.0.html

dmnbars commented 2 years ago

or we can use one class (Phpmig\Adapter\Doctrine\DBAL) and statements like this:

if (\method_exists($this->connection, 'fetchAllAssociative')) {
    $all = $this->connection->fetchAllAssociative($sql);
} else {
    $all = $this->connection->fetchAll($sql);
}

and

if (\method_exists($this->connection, 'executeQuery')) {
    $this->connection->executeQuery($sql);
} else {
    $this->connection->query($sql);
}