Skip to content

Conversation

@amotl
Copy link
Member

@amotl amotl commented Nov 24, 2022

About

Doctrine DBAL 3.0 was released on November 17, 2020.

Details

The major theme of DBAL 3.0 is the decoupling from PDO. Instead of copying the API verbatim like DBAL 2.0 did, DBAL 3.0 grows it into a better, more usable direction.

-- https://www.doctrine-project.org/2020/11/17/dbal-3.0.0.html

@amotl amotl force-pushed the amo/doctrine3 branch 3 times, most recently from c0dddcc to f1a7a40 Compare May 5, 2023 16:50
@amotl
Copy link
Member Author

amotl commented May 5, 2023

Other than many deprecation warnings, because crate/crate-pdo#146 has not been merged and released yet, running the tests here 1 raise this fatal error 2:

Fatal error: Declaration of Crate\PDO\PDO::prepare($statement, $options = null) must be compatible
with Doctrine\DBAL\Driver\Connection::prepare(string $sql): Doctrine\DBAL\Driver\Statement
in /path/to/crate-dbal/vendor/crate/crate-pdo/src/Crate/PDO/PDO.php on line 193

Footnotes

  1. composer run test

  2. https://github.com/crate/crate-dbal/actions/runs/4895679362/jobs/8741560882?pr=122#step:8:18

@amotl
Copy link
Member Author

amotl commented May 5, 2023

It will make no sense to continue working on this before crate/crate-pdo#146 has been merged. Otherwise, there are too many type errors to work around.

In other words, fa8ef49 should be removed again.

@ricohumme
Copy link

Hi @amotl I came across this and was wondering if this will be merge soon now that PR holding you back is merged?

@amotl
Copy link
Member Author

amotl commented Apr 13, 2024

Dear Rico,

thank you for writing in. I am not sure if this patch in its current state is enough to add support for Doctrine 3. Is it?

now that PR holding you back is merged?

because crate/crate-pdo#146 has not been merged and released yet
-- #122 (comment)

Ah, I see. Yeah, this would probably need a refresh. Thanks for the reminder!

With kind regards,
Andreas.

@andythedandy
Copy link

Hi @amotl,
is there something I can support with to get this PR going? (As I would need that ^^)

regards,
Andy

@amotl amotl self-assigned this Feb 2, 2025
@amotl
Copy link
Member Author

amotl commented Feb 12, 2025

Hi @andythedandy. Thank you for writing in and for offering support. This patch certainly needs more love to satisfy CI. Would you be able to spend a few cycles on it?

On the other hand, GH-136 by @JulianMar may also be very relevant in this regard, and could make this patch obsolete, by skipping support for Doctrine 3 altogether.

@amotl amotl added help wanted important Not a bug, still important. dependencies Something about dependencies. labels Feb 12, 2025
@amotl amotl removed their assignment Jun 19, 2025
@coderabbitai
Copy link

coderabbitai bot commented Nov 13, 2025

Walkthrough

Upgrades the Crate DBAL driver to Doctrine DBAL 3: replaces inheritance with composition in driver/statement/connection layers, adds DBAL3 interfaces (VersionAwarePlatformDriver, ExceptionConverter), introduces Result wrapper, adds return types and public constants, updates types/platform APIs, tests, docs, and tooling for DBAL 3 compatibility. (≤50 words)

Changes

Cohort / File(s) Summary
Dependency & Tooling
composer.json, .php-cs-fixer.php, .gitignore
Bumped doctrine/dbal ^2 → ^3, crate-pdo, replaced phpcs with php-cs-fixer, updated scripts and autoload-dev, added .php-cs-fixer config and ignore rule for *.cache.
Driver Core (composition)
src/Crate/DBAL/Driver/PDOCrate/CrateStatement.php, src/Crate/DBAL/Driver/PDOCrate/PDOConnection.php, src/Crate/DBAL/Driver/PDOCrate/Driver.php
Replaced inheritance with composition: CrateStatement now final delegating to internal PDOStatement; PDOConnection delegates to internal PDOCrateDB; Driver implements VersionAwarePlatformDriver, exposes public VERSION/NAME, new connect signature and getExceptionConverter.
Exception conversion & Results
src/Crate/DBAL/Driver/PDOCrate/ExceptionConverter.php, src/Crate/DBAL/Driver/PDOCrate/Result.php
Added ExceptionConverter implementing ExceptionConverterInterface with DB error→DBAL exception mappings and a PHP bug workaround; added Result wrapper implementing Driver Result, delegating fetch/row/col/free and integrating FetchUtils with exception translation.
Platform APIs & Keywords
src/Crate/DBAL/Platforms/CratePlatform.php, src/Crate/DBAL/Platforms/CratePlatform1.php, src/Crate/DBAL/Platforms/CratePlatform4.php, src/Crate/DBAL/Platforms/Keywords/CrateKeywords.php
Promoted constants to public, added getCurrentDatabaseExpression, applied scalar return-type hints across many platform methods, set default isolation READ_UNCOMMITTED, and minor keyword method type hints.
Types
src/Crate/DBAL/Types/ArrayType.php, src/Crate/DBAL/Types/MapType.php, src/Crate/DBAL/Types/TimestampType.php
Made NAME and other type constants public, added return types (mixed/string) to conversion/declaration methods, moved to DBAL 3 Types usage, tweaked null/array handling and minor arithmetic casts.
Schema Manager
src/Crate/DBAL/Schema/CrateSchemaManager.php
Added CratePlatform generic docblock, renamed listTableDetails parameter to $name, added return types, made flatten static, replaced fetchAssoc → fetchAssociative and updated signatures.
Tests (functional & platform)
test/Crate/Test/DBAL/Functional/*, test/Crate/Test/DBAL/Platforms/CratePlatformTest.php, test/Crate/Test/DBAL/DBALFunctionalTest.php
Updated base class DBALFunctionalTestCase → DBALFunctionalTest, replaced getSchemaManager → createSchemaManager, migrated to DBAL 3 APIs (execute→executeQuery/executeStatement, bindParam→bindValue, fetch→fetchAssociative/... ), switched Type constants to Types, added transaction and server-version tests, adjusted many signatures and return types.
Docs & Examples
docs/*, examples/objects.php, CHANGES.txt
Updated docs for DBAL 3 API (DriverManager import, createSchemaManager), changed Table constructor examples (5th arg 0 → []), added eventual-consistency note and REFRESH guidance, added objects example, updated CHANGES mentioning DBAL3 support and default isolation change.
Minor formatting / metadata
src/Crate/DBAL/Platforms/CratePlatform4.php, src/Crate/DBAL/Platforms/Keywords/CrateKeywords.php, docs/*
Added/adjusted return types or visibility on small APIs and doc formatting; minor non-functional style changes.

Sequence Diagram(s)

sequenceDiagram
    participant App as Application
    participant Conn as PDOConnection
    participant PDO as PDOCrateDB
    participant Stmt as CrateStatement
    participant Res as Result

    App->>Conn: prepare(sql, options)
    Conn->>PDO: prepare(sql, options)
    PDO-->>Conn: PDOStatement
    Conn->>Stmt: new CrateStatement(PDOInterface, sql, options)
    Conn-->>App: CrateStatement

    App->>Stmt: execute(params?)
    Note right of Stmt: deprecation notice if params provided
    Stmt->>PDO: $stmt->execute()
    Stmt->>Res: new Result(Stmt)
    Res-->>App: ResultInterface

    App->>Res: fetchAssociative()
    Res->>Stmt: fetch(FETCH_ASSOC)
    Stmt->>PDO: fetch(FETCH_ASSOC)
    PDO-->>Res: row|false
    Res-->>App: row|false
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Areas needing extra attention:
    • CrateStatement & PDOConnection delegation and full exception translation paths
    • Driver.connect signature, #[SensitiveParameter] usage, and getExceptionConverter correctness
    • ExceptionConverter mapping accuracy and PHP bug 64705 workaround
    • Result wrapper fetch/FetchUtils integration and error handling
    • Platform method return-type changes that may alter null/string expectations
    • Broad test updates verifying API behavior (executeQuery vs execute, type registry usage)

Possibly related PRs

  • DBAL3: More updates #147 — overlapping DBAL3 compatibility work, similar refactors to driver, statements, connection and tests.

Suggested reviewers

  • seut
  • surister

Poem

🐇 I hopped from extends to compose today,
Constants unveiled, types led the way,
Tests refreshed, docs now sing,
DBAL3 bells softly ring,
A rabbit's nibble — code in bloom, hooray!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.22% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Support for Doctrine DBAL 3' accurately reflects the main change: upgrading from Doctrine DBAL 2 to Doctrine DBAL 3, as confirmed by CHANGES.txt and composer.json updates.
Description check ✅ Passed The description is relevant to the changeset, explaining the DBAL 3.0 release context and its major theme of decoupling from PDO, which aligns with the substantial refactoring visible throughout the PR.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch amo/doctrine3

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@amotl amotl marked this pull request as ready for review November 14, 2025 06:51
coderabbitai[bot]

This comment was marked as resolved.

@amotl amotl changed the title [DRAFT] Add support for Doctrine 3 Add support for Doctrine 3 Nov 14, 2025
coderabbitai[bot]

This comment was marked as resolved.

@amotl amotl changed the title Add support for Doctrine 3 Add support for Doctrine DBAL 3.0 Nov 14, 2025
@amotl amotl changed the title Add support for Doctrine DBAL 3.0 Add support for Doctrine DBAL 3 Nov 14, 2025
coderabbitai[bot]

This comment was marked as resolved.

@amotl
Copy link
Member Author

amotl commented Nov 20, 2025

@seut: Thanks for your diligent review. I've integrated the secondary branch, applied updates according to your suggestions, went into a few conversations with CodeRabbit, and also tried to improve accordingly.

I've not resolved corresponding conversation threads for your information and acknowledgement. Please resolve and collapse them as you go at your disposal.

@amotl
Copy link
Member Author

amotl commented Nov 20, 2025

Hi @seut. Thanks for more review procedures. Those patches aim to improve two more details we talked about here.

This ticket tracks the item about implementing getServerVersion() properly.

Please resolve and collapse pending conversation threads after reading up.

Comment on lines -69 to +80
public function getDatabasePlatform()
public function getDatabasePlatform(): AbstractPlatform
{
return new CratePlatform();
return new CratePlatform4();
Copy link
Member Author

Choose a reason for hiding this comment

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

This needs to pull in the logic from createDatabasePlatformForVersion.

Copy link
Member Author

@amotl amotl Nov 21, 2025

Choose a reason for hiding this comment

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

It did not quite work like I thought it would work, obviously because getDatabasePlatform() does not have connection options available, so it can't connect to CrateDB to inquire its version number. This resembles a traditional and solid chicken-and-egg problem.

As a consequence, I made this, to at least improve the canonical example program a bit more, in order to demonstrate proper(?) use of createDatabasePlatformForVersion().

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/Crate/DBAL/Driver/PDOCrate/PDOConnection.php (1)

74-95: Consider tightening exec() error handling and simplifying query()

Two small, non‑blocking improvements:

  1. exec(): rely on explicit error handling instead of assert

assert($result !== false); is often disabled in production, so a false result could silently pass through and be coerced to 0 by the int return type. Since you already use exception mode, it’s safer and clearer to treat false as an error:

    public function exec($sql): int
    {
-        try {
-            $result = $this->connection->exec($sql);
-            assert($result !== false);
-            return $result;
-        } catch (PDOException $exception) {
-            throw Exception::new($exception);
-        }
+        try {
+            $result = $this->connection->exec($sql);
+            if ($result === false) {
+                // Defensive: should not happen with ERRMODE_EXCEPTION, but guard anyway.
+                throw new PDOException('Execution failed without throwing an exception.');
+            }
+
+            return $result;
+        } catch (PDOException $exception) {
+            throw Exception::new($exception);
+        }
    }
  1. query(): reuse CrateStatement::execute() result and drop redundant catch

CrateStatement::execute() already converts PDOException to a Doctrine driver exception and returns a ResultInterface. You can avoid creating a second Result and the now‑redundant PDOException catch:

-    public function query(string $sql): ResultInterface
-    {
-        try {
-            $stmt = $this->prepare($sql);
-            $stmt->execute();
-            return new Result($stmt);
-        } catch (PDOException $exception) {
-            throw Exception::new($exception);
-        }
-    }
+    public function query(string $sql): ResultInterface
+    {
+        $stmt = $this->prepare($sql);
+
+        return $stmt->execute();
+    }

This keeps error behavior identical while shaving off one allocation and some unreachable exception handling.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d920f69 and 1711168.

📒 Files selected for processing (5)
  • docs/index.rst (2 hunks)
  • examples/objects.php (1 hunks)
  • src/Crate/DBAL/Driver/PDOCrate/Driver.php (6 hunks)
  • src/Crate/DBAL/Driver/PDOCrate/PDOConnection.php (3 hunks)
  • test/Crate/Test/DBAL/Functional/ConnectionTest.php (4 hunks)
✅ Files skipped from review due to trivial changes (1)
  • docs/index.rst
🚧 Files skipped from review as they are similar to previous changes (1)
  • examples/objects.php
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-19T23:30:55.289Z
Learnt from: amotl
Repo: crate/crate-dbal PR: 122
File: src/Crate/DBAL/Driver/PDOCrate/PDOConnection.php:48-48
Timestamp: 2025-11-19T23:30:55.289Z
Learning: In crate-dbal's PDOConnection.php, PDO::ATTR_STATEMENT_CLASS is set using a bare class string (PDOStatement::class) rather than the standard PDO array format ([ClassName::class, [args]]) because PDOCrateDB is a custom PDO implementation that accepts a class name string directly for this attribute.

Applied to files:

  • src/Crate/DBAL/Driver/PDOCrate/Driver.php
  • test/Crate/Test/DBAL/Functional/ConnectionTest.php
  • src/Crate/DBAL/Driver/PDOCrate/PDOConnection.php
🧬 Code graph analysis (3)
src/Crate/DBAL/Driver/PDOCrate/Driver.php (6)
src/Crate/DBAL/Platforms/CratePlatform.php (2)
  • CratePlatform (42-888)
  • getName (476-479)
src/Crate/DBAL/Platforms/CratePlatform1.php (1)
  • CratePlatform1 (26-46)
src/Crate/DBAL/Platforms/CratePlatform4.php (1)
  • CratePlatform4 (26-94)
src/Crate/DBAL/Schema/CrateSchemaManager.php (1)
  • CrateSchemaManager (37-151)
src/Crate/DBAL/Driver/PDOCrate/PDOConnection.php (1)
  • PDOConnection (35-152)
src/Crate/DBAL/Driver/PDOCrate/ExceptionConverter.php (1)
  • ExceptionConverter (23-58)
test/Crate/Test/DBAL/Functional/ConnectionTest.php (3)
test/Crate/Test/DBAL/DBALFunctionalTest.php (1)
  • DBALFunctionalTest (32-124)
src/Crate/DBAL/Driver/PDOCrate/PDOConnection.php (6)
  • getNativeConnection (61-64)
  • prepare (74-81)
  • beginTransaction (126-133)
  • commit (135-142)
  • rollBack (144-151)
  • getServerVersion (52-59)
src/Crate/DBAL/Driver/PDOCrate/CrateStatement.php (1)
  • getWrappedStatement (147-150)
src/Crate/DBAL/Driver/PDOCrate/PDOConnection.php (3)
src/Crate/DBAL/Driver/PDOCrate/Driver.php (1)
  • Driver (36-131)
src/Crate/DBAL/Driver/PDOCrate/Result.php (1)
  • Result (12-108)
src/Crate/DBAL/Driver/PDOCrate/CrateStatement.php (2)
  • CrateStatement (39-151)
  • execute (57-74)
🔇 Additional comments (12)
test/Crate/Test/DBAL/Functional/ConnectionTest.php (7)

24-34: LGTM! Clean migration to DBAL 3 structure.

The imports, class naming, and trait usage are well-aligned with Doctrine DBAL 3 patterns. The VerifyDeprecations trait is appropriate for tracking any deprecation warnings during the migration.


48-63: Well-structured authentication test.

The explicit connect() call followed by credential verification via getNativeConnection() properly validates that HTTP Basic Auth credentials are correctly propagated to the native PDO connection.


76-92: Comprehensive statement wrapper validation.

The three-layer assertion chain correctly verifies the DBAL 3 statement wrapping architecture, from the outer Doctrine\DBAL\Statement through the driver-specific layers down to the native PDO statement.


105-114: LGTM! Transaction happy path properly tested.

These tests correctly verify that beginTransaction() and commit() return expected boolean values when used in the correct sequence.


138-162: Excellent server version validation.

Both tests comprehensively verify server version retrieval across both connection layers (native and wrapped). The semver regex pattern correctly allows version suffixes (pre-release/build metadata), which is appropriate for real-world version strings.

These tests properly validate the getServerVersion() implementation referenced in the PR objectives (GH-154).


116-121: Verify exception message matches DBAL 3 behavior: CONFIRMED ✓

The test correctly expects ConnectionException with the message "There is no active transaction." which matches DBAL's ConnectionException::noActiveTransaction() method. The test structure and expectations align with Doctrine DBAL 3 behavior.


123-136: Verify rollback exception handling behavior.

The tests correctly expect different exceptions based on transaction state:

  • With active transaction: Doctrine\DBAL\Driver\Exception with "Unsupported functionality"
  • Without active transaction: ConnectionException with "There is no active transaction."

Please verify these exception types and messages match the actual implementation behavior when CrateDB's unsupported rollback operation is invoked.

src/Crate/DBAL/Driver/PDOCrate/PDOConnection.php (3)

37-50: Connection wiring and PDO attributes look correct

The encapsulation of PDOCrateDB plus setting ATTR_STATEMENT_CLASS and ATTR_ERRMODE on the inner connection is consistent with the crate‑pdo standardization work and gives you predictable exception behavior from the outset. I don’t see issues here.


52-64: getServerVersion() / getNativeConnection() integration is sound

Delegating getServerVersion() and getNativeConnection() to the inner PDOCrateDB while wrapping PDOException keeps the driver surface aligned with Doctrine’s expectations without exposing raw PDO errors. This also addresses the earlier concern about hard‑coded server versions.


108-151: Quote, lastInsertId, and transaction delegation are consistent

quote(), lastInsertId(), and the transaction methods now uniformly delegate to PDOCrateDB and wrap PDOException into Doctrine’s driver exception type, matching the rest of the class and Doctrine’s expectations. No further changes needed here from my side.

src/Crate/DBAL/Driver/PDOCrate/Driver.php (2)

63-121: Platform selection and schema/exception plumbing look correct

  • getDatabasePlatform(): AbstractPlatform returning CratePlatform4 is a sensible default for modern CrateDB deployments.
  • createDatabasePlatformForVersion() still encapsulates the version‑based selection between CratePlatform, CratePlatform1, and CratePlatform4, which Doctrine will use when server version information is available.
  • getSchemaManager() and getExceptionConverter() cleanly hook in the Crate‑specific schema manager and exception converter.

I don’t see any behavioral regressions here; this wiring should work as intended with DBAL 3.


48-56: connect() and DSN construction align with DBAL 3.x/4.x driver expectations

The connect(array $params): PDOConnection signature correctly extracts credentials and driver options from the $params array (keys user, password, driver_options), which matches Doctrine DBAL's standard approach for custom drivers. The #[SensitiveParameter] annotation appropriately marks sensitive credentials, and the DSN construction passes all driver options through, keeping the implementation flexible.

@amotl
Copy link
Member Author

amotl commented Nov 22, 2025

^^ @seut: What do you think about the two most recent nitpick comments by CodeRabbit? They don't sound too bad, let's try?

@seut
Copy link
Member

seut commented Nov 24, 2025

^^ @seut: What do you think about the two most recent nitpick comments by CodeRabbit? They don't sound too bad, let's try?

I do not agree on the 1st one as the result is an int, isn't than any false correctly returned as 0? So why is anything more needed? The assert looks wrong then and should just be removed?

The 2nd one sounds very valid and I agree to apply the suggestion.

@amotl
Copy link
Member Author

amotl commented Nov 24, 2025

Thanks, I agree. 07e207a removes the assert, and 27294b0 applies the suggestion by CodeRabbit.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/Crate/DBAL/Driver/PDOCrate/PDOConnection.php (1)

119-144: Transaction methods correctly delegate to internal connection.

All three transaction methods properly delegate to PDOCrateDB with consistent exception wrapping. The implementation aligns with the documented approach: CrateDB's eventual consistency model is documented (docs/index.rst per learnings), and the methods perform real operations rather than being silent no-ops.

Optional suggestion for consistency: Consider adding return type hints (likely bool) to these three methods to match the style of all other methods in the class:

public function beginTransaction(): bool
public function commit(): bool  
public function rollBack(): bool

Based on learnings, documentation was added to docs/index.rst explaining CrateDB's eventual consistency model and transaction behavior.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8df8f90 and 27294b0.

📒 Files selected for processing (1)
  • src/Crate/DBAL/Driver/PDOCrate/PDOConnection.php (3 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: amotl
Repo: crate/crate-dbal PR: 122
File: src/Crate/DBAL/Driver/PDOCrate/PDOConnection.php:48-48
Timestamp: 2025-11-19T23:30:55.289Z
Learning: In crate-dbal's PDOConnection.php, PDO::ATTR_STATEMENT_CLASS is set using a bare class string (PDOStatement::class) rather than the standard PDO array format ([ClassName::class, [args]]) because PDOCrateDB is a custom PDO implementation that accepts a class name string directly for this attribute.
📚 Learning: 2025-11-19T23:30:55.289Z
Learnt from: amotl
Repo: crate/crate-dbal PR: 122
File: src/Crate/DBAL/Driver/PDOCrate/PDOConnection.php:48-48
Timestamp: 2025-11-19T23:30:55.289Z
Learning: In crate-dbal's PDOConnection.php, PDO::ATTR_STATEMENT_CLASS is set using a bare class string (PDOStatement::class) rather than the standard PDO array format ([ClassName::class, [args]]) because PDOCrateDB is a custom PDO implementation that accepts a class name string directly for this attribute.

Applied to files:

  • src/Crate/DBAL/Driver/PDOCrate/PDOConnection.php
📚 Learning: 2025-11-21T18:32:35.719Z
Learnt from: amotl
Repo: crate/crate-dbal PR: 122
File: src/Crate/DBAL/Driver/PDOCrate/PDOConnection.php:0-0
Timestamp: 2025-11-21T18:32:35.719Z
Learning: Documentation update: docs/index.rst now explicitly states CrateDB implements eventual consistency and does not support traditional ACID transactions (commit 171116851). Preference in this repo is to document this limitation rather than raise runtime exceptions in transaction methods.

Applied to files:

  • src/Crate/DBAL/Driver/PDOCrate/PDOConnection.php
🧬 Code graph analysis (1)
src/Crate/DBAL/Driver/PDOCrate/PDOConnection.php (3)
src/Crate/DBAL/Driver/PDOCrate/Driver.php (1)
  • Driver (36-131)
src/Crate/DBAL/Driver/PDOCrate/Result.php (1)
  • Result (12-108)
src/Crate/DBAL/Driver/PDOCrate/CrateStatement.php (2)
  • CrateStatement (39-151)
  • execute (57-74)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build docs on ubuntu-latest
🔇 Additional comments (3)
src/Crate/DBAL/Driver/PDOCrate/PDOConnection.php (3)

45-50: LGTM! Constructor properly configured for DBAL 3 integration.

The composition pattern is well-implemented: internal PDOCrateDB instance is created and configured with correct PDO attributes. The ATTR_STATEMENT_CLASS array format [PDOStatement::class, []] is now supported after crate-pdo PR #192 was merged, resolving the earlier standardization discussion.

Based on learnings, the ATTR_STATEMENT_CLASS format was standardized in crate-pdo PR #192.


52-99: Excellent delegation and error handling implementation.

All core connection methods properly delegate to the internal PDOCrateDB instance with consistent exception wrapping:

  • getServerVersion(), prepare(), exec() wrap PDOException into DBAL exceptions
  • getNativeConnection() provides clean access to underlying connection
  • query() uses the standard prepare-then-execute pattern

The prepare() method correctly passes $options to CrateStatement constructor, resolving the earlier parameter mismatch issue.


101-117: LGTM! quote() and lastInsertId() properly implemented.

Both methods follow the consistent exception-handling pattern established throughout the class, with proper delegation to the internal connection and return type hints.

Copy link
Member

@seut seut left a comment

Choose a reason for hiding this comment

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

Thanks for all the iterations!
Looks good to me now.

@amotl amotl merged commit 2d084bb into main Nov 26, 2025
12 checks passed
@amotl amotl deleted the amo/doctrine3 branch November 26, 2025 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Something about dependencies. help wanted important Not a bug, still important.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants