Scott Jones
Scott Jones

Reputation: 160

Symfony2 Doctrine DBAL Wrapper Issue

I am trying to create a custom wrapper for a DBAL connection and have correctly setup the config.yml file,

however I am getting the following error:

DBALException: The given 'wrapperClass' Some\Bundle\Doctrine\DBAL\ExtendedConnection 
has to be a subtype of \Doctrine\DBAL\Connection.

However my class is extending the \Doctrine\DBAL\Connection:

namespace Some\Bundle\Doctrine\DBAL\ExtendedConnection;

use Doctrine\DBAL\Connection AS Connection;

class ExtendedConnection extends Connection
{
    public function multipleResultSetsFetchAll()
    {
        $stmt = $this->getConnection();
        do{
            $results[] = $stmt->fetchAll();
        }while($stmt->nextRowset());

        return $results;
    }
}

Any Ideas?

Upvotes: 2

Views: 2125

Answers (2)

Colin Rickels
Colin Rickels

Reputation: 109

It is also important to note that when defining the class name in your doctrine yaml or xml, you must supply the fully qualified namespace. This was a gotcha for me as doctrines documentation only uses the class name. Good ole doctrine!

Upvotes: 0

Scott Jones
Scott Jones

Reputation: 160

I managed to find the problem here - it was the filename. My file name was Conection.php but changing it to ExtendedConnection.php worked.

Upvotes: 1

Related Questions