Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Unsupported driver Exception #105

@jacekjagiello

Description

@jacekjagiello

Hello again,
In issue #103 I've changed DB_CONNECTION to mysql and driver for this connection to pdo_mysql. Howere, now there is some issue when I register new user using default AuthController and Doctrine driver provided by this lib.
When I send POST request to localhost/auth/register to register user I got:

InvalidArgumentException in ConnectionFactory.php line 189: 
Unsupported driver [pdo_mysql]

I tried to debug, this. In ConnectionFactory class there's method

 public function createConnector(array $config)
    {
        if (!isset($config['driver'])) {
            throw new InvalidArgumentException('A driver must be specified.');
        }

        if ($this->container->bound($key = "db.connector.{$config['driver']}")) {
            return $this->container->make($key);
        }

        switch ($config['driver']) {
            case 'mysql':
                return new MySqlConnector;

            case 'pgsql':
                return new PostgresConnector;

            case 'sqlite':
                return new SQLiteConnector;

            case 'sqlsrv':
                return new SqlServerConnector;
        }

        throw new InvalidArgumentException("Unsupported driver [{$config['driver']}]");
    }

And I found that my $config['driver'] is set to pdo_mysql as expected, but as we can see there's no pdo_mysql in switch.

How to setup this driver correctly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions