Skip to content

Add PDO adapter + Symfony DBAL-style prepared statement API (fully BC)#4

Draft
Copilot wants to merge 4 commits intomasterfrom
copilot/design-approach-with-modern-php
Draft

Add PDO adapter + Symfony DBAL-style prepared statement API (fully BC)#4
Copilot wants to merge 4 commits intomasterfrom
copilot/design-approach-with-modern-php

Conversation

Copy link

Copilot AI commented Feb 28, 2026

Moves toward a Symfony DBAL-style query interface backed by PDO and native prepared statements, while keeping the existing MySQLi/interpolated-SQL path entirely intact.

New surface area

  • PdoAdapter — drop-in AdapterInterface replacement using PDO. Also implements PreparedStatementAdapterInterface so parameterised dispatch is automatic.
  • PreparedStatementAdapterInterface — opt-in interface with a single method executeWithParams(string $sql, array $params). MySQLi does not implement it; all existing code is unaffected.
  • Connection::executeQuery() / Connection::executeStatement() — Symfony DBAL-style entry points. Route to executeWithParams() when the adapter supports it, otherwise fall back silently to execute().
  • AbstractQuery::toSql() — returns [string $sql, array $bindings] with ? placeholders intact. Scalar, array (IN-list), and nested sub-query bindings are all handled. getString() / assemble() are not changed.

ConnectionFactory

Set driver => pdo_mysql or use_pdo => true in the connection config to get a PDO-backed connection wired through the existing MySqlConnector (charset, timezone, strict-mode all applied).

Usage

// Raw parameterised SQL — works with any adapter
$result   = $conn->executeQuery('SELECT * FROM users WHERE id = ?', [42]);
$affected = $conn->executeStatement('UPDATE users SET active=? WHERE id=?', [1, 42]);

// Query builder → toSql() → executeQuery()
[$sql, $params] = $conn->newSelect()
    ->from('users')
    ->where('id = ?', 42)
    ->where('active = ?', 1)
    ->toSql();
$result = $conn->executeQuery($sql, $params);

// Opt-in to PDO via factory config
$conn = $factory->make(['driver' => 'pdo_mysql', 'host' => '', …]);

Note: PdoAdapter cannot be named Pdo — PHP's case-insensitive class registry collides with the built-in \PDO.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/CarbonPHP/carbon-doctrine-types/zipball/18ba5ddfec8976260ead6e866180bd5d2f71aa1d
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/CarbonPHP/carbon/zipball/f438fcc98f92babee98381d399c65336f3a3827f
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/alcohol/iso3166/zipball/928ac7ecc569db9123a83ef5b1c6efc279e7cb49
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/brick/math/zipball/63422359a44b7f06cae63c3b429b59e8efcc0629
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/bytic/Collections/zipball/d187ad0a5f4731fcc686c2ea97a64fd9e932a57f
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/bytic/cache/zipball/c9ea247b8349e0dfcd54932f1676042064182483
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/bytic/container/zipball/d1c580b989335bf1e934d6d41ef6ae8216b0cf5d
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/bytic/inflector/zipball/bdce7bfb611087bb51ffbd1f1cca6dd745ee820d
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/bytic/package-base/zipball/07c70b19834ee69fad3b6809cf06fb54c08d72db
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/bytic/profiler/zipball/2957ecb241482a2fa8d0c2336b37adc228c31df0
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/bytic/utility/zipball/20382da5e77f5e8ec31623a4a10c531cb9cdf548
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/php-fig/simple-cache/zipball/764e0b3939f5ca87cb904f570ef9be2d78a07865
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/ramsey/collection/zipball/344572933ad0181accbf4ba763e85a0306a8c5e2
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/ramsey/uuid/zipball/8429c78ca35a09f27565311b98101e2826affde0
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/symfony/cache-contracts/zipball/5d68a57d66910405e5c0b63d6f0af941e66fc868
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/symfony/cache/zipball/e3e76b9ba0dff3dfe08ebda500723976dd9de407
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/symfony/clock/zipball/9169f24776edde469914c1e7a1442a50f7a4e110
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/symfony/dependency-injection/zipball/91e49958b8a6092e48e4711894a1aeb1b151c62a
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/symfony/deprecation-contracts/zipball/605389f2a7e5625f273b53960dc46aeaf9c62918
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/symfony/polyfill-php80/zipball/0cc9dd0f17f61d8131e7df6b84bd344899fe2608
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/symfony/polyfill-php83/zipball/17f6f9a6b1735c0f163024d959f700cfbc5155e5
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/symfony/service-contracts/zipball/f37b419f7aea2e9abf10abd261832cace12e3300
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/symfony/translation-contracts/zipball/450d4172653f38818657022252f9d81be89ee9a8
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/symfony/translation/zipball/98f26acc99341ca4bab345fb14d7b1d7cb825bed
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/symfony/var-exporter/zipball/03a60f169c79a28513a78c967316fbc8bf17816f
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)
  • https://api.github.com/repos/voku/portable-ascii/zipball/b1d923f88091c6bf09699efcd7c8a1b1bfd7351d
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/904Rf4 /usr/bin/composer install --no-dev --no-interaction --no-progress (http block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 28, 2026 10:59
…, and improved exception hierarchy

Co-authored-by: gabrielsolomon <17990591+gabrielsolomon@users.noreply.github.com>
…e, charset/modes security validation, variable naming

Co-authored-by: gabrielsolomon <17990591+gabrielsolomon@users.noreply.github.com>
Copilot AI changed the title [WIP] Designing solutions with modern PHP features and clean architecture Modernize bytic/database towards Symfony DBAL conventions with strict types and security hardening Feb 28, 2026
…lly backward compatible)

Co-authored-by: gabrielsolomon <17990591+gabrielsolomon@users.noreply.github.com>
Copilot AI changed the title Modernize bytic/database towards Symfony DBAL conventions with strict types and security hardening Add PDO adapter + Symfony DBAL-style prepared statement API (fully BC) Feb 28, 2026
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