doctrine / doctrine/DoctrineBundle

Please give ConnectionFactory an interface

Open
#2,133 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
4.8k
Forks
482
Avg merge
1h 51m
Merged PRs (30d)
3

Description

### Feature Request

#### What

With your version 3 you made ConnectionFactory final, forcing us to wrap the service instead of extending it. This works fine, but there is no interface we could be using.

#### Why

We use a custom ConnectionFactory to inject additional services into our custom connection that we need.

Also we register some additional and complex database types in there that are not compatible with ConnectionFactory::initializeTypes.

#### How

Implementing an interface like this would already suffice:

```php

interface ConnectionFactoryInterface {
public function createConnection(array $params, ?Configuration $config = null, array $mappingTypes = []): Connection;
}

```

Thank you

Contributor guide

Open the contributing guide

Research direction

Start by locating the existing ConnectionFactory entry point and its tests, then trace how the bundle obtains and uses the factory. Define the interface around the createConnection signature shown in the issue and verify that custom implementations can be supplied without changing existing behavior; add or update focused tests for both the default factory and injection path.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.