Skip to content

feat: Add Doctrine DBAL QueryBuilder support#101

Draft
romankonz wants to merge 5 commits into
4.0.xfrom
feat/doctrine-query-builder
Draft

feat: Add Doctrine DBAL QueryBuilder support#101
romankonz wants to merge 5 commits into
4.0.xfrom
feat/doctrine-query-builder

Conversation

@romankonz

@romankonz romankonz commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

POC(!) der noch nicht poliert ist.

romankonz and others added 5 commits June 23, 2026 22:50
…eryBuilder()

Introduces a thin adapter layer (src/Doctrine/) that bridges the Artemeon
Connection to Doctrine DBAL's Driver interface, enabling use of the DBAL
QueryBuilder against all three supported databases (MySQL, PostgreSQL, SQLite).

- Connection::createQueryBuilder() returns a DBAL QueryBuilder backed by the
  existing connection (no new physical connection is opened; DBAL instance is
  cached per Connection object)
- DML parameters are passed without HTML-escaping to match the behaviour of
  the existing fetch methods
- MysqlDriver queries SELECT VERSION() once to let DBAL pick the correct
  platform (MySQL vs MariaDB) instead of hard-coding a version string
- Connection::quote() escapes backslashes before single quotes to prevent
  SQL injection on MySQL with default sql_mode
- exec() return type widened to int|string to match the DriverConnection
  interface contract
- fetchFirstColumn() sentinel fix: loops on fetchNumeric() to avoid
  false-cell truncation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- exec(): narrow return type back to int (covariant narrowing of the
  interface's int|string is valid; string is never returned in practice)
- MysqlDriver: guard fetchOne() result with is_string() before passing
  as server version string (fetchOne returns mixed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add doctrine/dbal:^4 to require (was missing; only came in transitively
  via dev dependencies, causing AbstractSQLiteDriver not found in CI)
- Apply Pint style fixes (binary_operator_spaces, whitespace_after_comma,
  ordered_imports, single_quote)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@romankonz romankonz requested review from chriskapp, marcreichel and sidler and removed request for chriskapp June 24, 2026 05:06
{
$version = $this->connection->fetchOne('SELECT VERSION()');

return new DriverConnectionAdapter($this->connection, is_string($version) ? $version : '8.0.0');

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

(?)


public function connect(#[SensitiveParameter] array $params): DriverConnection
{
return new DriverConnectionAdapter($this->connection, '16.0');

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

(?)


public function connect(#[SensitiveParameter] array $params): DriverConnection
{
return new DriverConnectionAdapter($this->connection, '3.0.0');

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

(?)

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.

1 participant