Skip to content

Conversation

@mbolli
Copy link

@mbolli mbolli commented Jan 11, 2026

This pull request introduces support for custom database adapter factories, allowing users to specify their own adapter factory class in the configuration. This brings greater flexibility for integrating custom database adapters. The changes include updates to the configuration handling, command usage, and related documentation, as well as tests to ensure correct behavior.

Configuration and Extensibility:

  • Added a new adapter_factory_class configuration option, allowing users to specify a fully qualified class name for a custom adapter factory. The class must implement Phoenix\Database\Adapter\AdapterFactoryInterface, and defaults to Phoenix\Database\Adapter\AdapterFactory.
  • Introduced the AdapterFactoryInterface interface and updated the existing AdapterFactory to implement it, enabling custom adapter factories.

Command and Internal Usage:

  • Modified command classes to use the adapter factory class specified in configuration, instead of hardcoding AdapterFactory.

Dependency and Compatibility:

  • Updated composer.json to allow both Symfony Console v7.4 and v8.0, increasing compatibility.

Testing:

  • Added tests for the new adapter_factory_class configuration, including validation of default, invalid, and custom values. Introduced a MockAdapterFactory for testing purposes.

Copilot AI and others added 6 commits January 11, 2026 19:19
Co-authored-by: mbolli <722725+mbolli@users.noreply.github.com>
Co-authored-by: mbolli <722725+mbolli@users.noreply.github.com>
Co-authored-by: mbolli <722725+mbolli@users.noreply.github.com>
Co-authored-by: mbolli <722725+mbolli@users.noreply.github.com>
Add adapter_factory_class config option for custom adapters
{
public static function instance(EnvironmentConfig $config): AdapterInterface
{
throw new \RuntimeException('Mock adapter factory should not be instantiated in tests');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please import class to uses

@lulco
Copy link
Owner

lulco commented Jan 12, 2026

LGTM, need to test for a while on some projects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants