Skip to content

Database-based stores should not enforce taking a PDO instance in their constructor #84

Open
@stof

Description

@stof

The PDO class connects to the DB server during its instantiation, making it a heavy constructor that is not desirable when using DI.
Symfony components generally either use the doctrine/dbal API (which connects lazily) or support passing a PDO DSN to connect lazily internally.

Btw, another drawback of the current approach is that it won't play well with long-running processes (while using AI in a messenger consumer can definitely be a legitimate case) as the connection can be closed or can timeout. In particular, the fromDbal static constructor extracting the native connection from a DBAL connection won't play well with cases where the DBAL connection gets closed and connects again later (common in messenger consumers) as that would create a new native connection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    StoreIssues & PRs about the AI Store component

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions