Skip to content

Conversation

norkunas
Copy link
Collaborator

@norkunas norkunas commented Oct 18, 2025

Pull Request

Related issue

Fixes #399

What does this PR do?

  • Adds support for doctrine bundle v3

PR checklist

Please check if your PR fulfills the following requirements:

  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Summary by CodeRabbit

  • New Features

    • Added support for Doctrine 3.x alongside existing 2.x compatibility.
  • Tests

    • Expanded CI test matrix to validate multiple dependency combinations (including non-locked lowest/highest sets).
    • Improved test-run labeling and coverage artifact names to include dependency variant; added dependency installation options and test working-directory.
    • Added/updated test configurations to support multiple PHP and Doctrine version paths.
  • Chores

    • Pinned certain dev packages for stability; updated code style migration rule.
    • Added deprecation baseline ignore entry.

@norkunas norkunas added the enhancement New feature or request label Oct 18, 2025
Copy link

coderabbitai bot commented Oct 18, 2025

Walkthrough

Adds runtime detection for DoctrineBundle v3 and conditional test configuration loading; reorganizes test YAMLs, updates Composer constraints to allow Doctrine 3.x, adjusts CI matrix to test locked/lowest/highest dependency scenarios, updates php-cs-fixer rule alias, and adds a deprecation baseline entry.

Changes

Cohort / File(s) Summary
CI workflow updates
.github/workflows/tests.yml
Adds dependencies matrix dimension (includes locked), expands exclude/include rules for dependency combinations, updates job name to append dependencies label when not locked, uses ${{ matrix.dependencies }} for install step, adds composer-options, sets working-directory for tests, and includes matrix.dependencies in coverage artifact name.
Dependency version constraints
composer.json
Allows doctrine/doctrine-bundle `^2.10
Kernel runtime configuration
tests/Kernel.php
Adds import for BlacklistSchemaAssetFilter, loads framework.yaml early, detects Doctrine v3 at runtime, conditionally loads doctrine.yaml / doctrine_v2.yaml / doctrine_old_proxy.yaml based on Doctrine version and PHP version, updates ORM DEFAULT_SCHEME_MAP logic to skip when v3 is active, removes lazy ghost objects block, preserves EntityValueResolver handling.
Framework configuration
tests/config/framework.yaml
Adds framework block with test: true, secret (32-char hex), and http_method_override: false.
Doctrine configuration (common)
tests/config/doctrine.yaml
Adds DBAL with SQLite at %kernel.cache_dir%/test.sqlite, registers dummy_object_id custom type, and adds ORM mappings (underscore_number_aware, auto_mapping, App mapping).
Doctrine configuration (php7 / v2 / old proxy)
tests/config/doctrine_php7.yaml, tests/config/doctrine_v2.yaml, tests/config/doctrine_old_proxy.yaml
Removed framework blocks (test/secret/http_method_override) from these versioned files; removed doctrine.orm.report_fields_where_declared: true where present; doctrine_php7.yaml now only contains DBAL.
Code style configuration
.php-cs-fixer.dist.php
Changes rule alias from @PHP80Migration:risky to @PHP8x0Migration:risky.
Test baseline
tests/baseline-ignore
Adds deprecation baseline entry for report_fields_where_declared deprecation tied to DoctrineBundle 3.0.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Kernel
    participant Runtime as RuntimeCheck
    participant FS as FileSystem

    Kernel->>Runtime: Check BlacklistSchemaAssetFilter exists
    Runtime-->>Kernel: doctrineBundleV3 = true/false

    Kernel->>FS: Load tests/config/framework.yaml
    FS-->>Kernel: ok

    alt PHP >= 8 and doctrineBundleV3
        Kernel->>FS: Load tests/config/doctrine.yaml
        FS-->>Kernel: ok
    else PHP >= 8 and LegacyReflectionFields exists and PHP >= 8.4
        Kernel->>FS: Load tests/config/doctrine_v2.yaml
        FS-->>Kernel: ok
    else
        Kernel->>FS: Load tests/config/doctrine_old_proxy.yaml
        FS-->>Kernel: ok
    end

    alt PHP 7 fallback
        Kernel->>Kernel: Prepend framework annotations/serializer/router config
        Kernel->>FS: Load tests/config/doctrine_php7.yaml
        FS-->>Kernel: ok
    end

    alt DEFAULT_SCHEME_MAP defined AND NOT doctrineBundleV3
        Kernel->>Kernel: Prepend specific ORM DEFAULT_SCHEME_MAP config
    end

    Kernel->>FS: Load tests/config/meilisearch.yaml
    FS-->>Kernel: ok
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

maintenance

Suggested reviewers

  • curquiza

Poem

🐰
A hop for configs, a twitch for tests,
Doctrine's three now joins the quests,
CI spins locked, lowest, highest rounds,
Kernel loads the right YAMLs and bounds,
I nibble bugs and stamp the grounds! 🍃

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Add support for doctrine bundle v3" is clear, concise, and directly reflects the primary objective of the pull request. The code changes across multiple files including composer.json (expanding doctrine/doctrine-bundle constraint to ^3.0), tests/Kernel.php (implementing runtime Doctrine version detection), and associated configuration files all confirm that the main focus is implementing Doctrine Bundle v3 support. The title accurately summarizes the changeset without being vague or misleading.
Linked Issues Check ✅ Passed The linked issue #399 "Add support for doctrine bundle v3" matches the stated objective in the PR description. The changes in the pull request implement this objective through multiple files: composer.json updates the doctrine/doctrine-bundle constraint to include ^3.0, tests/Kernel.php introduces runtime Doctrine version detection with conditional configuration loading, and various test configuration files are updated to handle both Doctrine v2 and v3. While the linked_issues section lacks detailed requirements from issue #399, the visible code changes clearly implement the stated goal of adding Doctrine v3 support.
Out of Scope Changes Check ✅ Passed The changes are tightly focused on Doctrine Bundle v3 support and its related dependencies. The composer.json updates to doctrine/doctrine-bundle and symfony/phpunit-bridge are necessary for Doctrine v3 compatibility. The .php-cs-fixer.dist.php change from @PHP80Migration:risky to @PHP8x0Migration:risky appears to be a supporting change for broader PHP version compatibility in the test environment. The tests/baseline-ignore entry directly addresses a Doctrine v3-specific deprecation notice. All modifications are contextually related to enabling and testing Doctrine v3 without introducing unrelated functionality.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@norkunas norkunas force-pushed the doctrinebundlev3 branch 2 times, most recently from 0a4e91a to 9c4efad Compare October 18, 2025 20:23
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: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 752afde and 6957c77.

📒 Files selected for processing (8)
  • .github/workflows/tests.yml (2 hunks)
  • composer.json (1 hunks)
  • tests/Kernel.php (2 hunks)
  • tests/config/config.yaml (0 hunks)
  • tests/config/config_doctrine_v2.yaml (1 hunks)
  • tests/config/config_old_proxy.yaml (0 hunks)
  • tests/config/doctrine_php7.yaml (0 hunks)
  • tests/config/framework.yaml (1 hunks)
💤 Files with no reviewable changes (3)
  • tests/config/doctrine_php7.yaml
  • tests/config/config_old_proxy.yaml
  • tests/config/config.yaml
🧰 Additional context used
🧬 Code graph analysis (1)
tests/Kernel.php (1)
src/DependencyInjection/MeilisearchExtension.php (1)
  • load (19-64)
🪛 actionlint (1.7.8)
.github/workflows/tests.yml

101-101: property "dependencies" is not defined in object type {deps: string; php-version: number; sf-version: number}

(expression)

🔇 Additional comments (8)
tests/config/framework.yaml (1)

1-4: LGTM!

Standard framework configuration for test environment. The settings are appropriate for integration tests.

tests/config/config_doctrine_v2.yaml (1)

1-22: LGTM! Doctrine v2-specific configuration is well-structured.

The configuration correctly isolates v2-specific ORM options (enable_native_lazy_objects, report_fields_where_declared) that are not available or have different semantics in v3.

tests/Kernel.php (4)

11-11: LGTM! Appropriate version detection strategy.

Using BlacklistSchemaAssetFilter as a version marker is a pragmatic approach since this class was removed in DoctrineBundle v3.


33-33: LGTM! Framework config externalized correctly.

Loading framework configuration from a separate file improves maintainability and aligns with the version-specific config strategy.


35-44: LGTM! Version-aware config loading is well-structured.

The conditional logic correctly handles:

  • DoctrineBundle v3 (loads config.yaml)
  • DoctrineBundle v2 with PHP 8.4+ and LegacyReflectionFields (loads config_doctrine_v2.yaml)
  • Older setups (loads config_old_proxy.yaml)

46-53: LGTM! PHP 7 compatibility handled appropriately.

The PHP 7 branch correctly configures annotations and loads the PHP 7-specific Doctrine config.

composer.json (1)

23-23: The constraint is correct—no changes needed.

The ^2.10 || ^3.0 constraint properly handles version resolution across supported PHP versions. DoctrineBundle v2.10 requires PHP ^7.4 or ^8.0, covering all versions your package supports. DoctrineBundle v3 requires PHP ^8.4, so Composer will:

  • Install v2.x on PHP 7.4-8.3 (where v3 is unavailable)
  • Install v3.x on PHP 8.4+ (where both are available)

This is appropriate package design that supports multiple dependency versions across different PHP versions.

.github/workflows/tests.yml (1)

101-101: No action required—default behavior is safe and correct.

The ramsey/composer-install action defaults to "locked" when dependency-versions is empty, installing locked versions equivalent to running composer install. This is the intended behavior for matrix entries without an explicit dependencies property, and no verification or code changes are needed.

Likely an incorrect or invalid review comment.

@norkunas norkunas force-pushed the doctrinebundlev3 branch 6 times, most recently from be47be4 to 2db723c Compare October 18, 2025 20:40
Copy link

codecov bot commented Oct 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.40%. Comparing base (e479bc2) to head (2db723c).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #400   +/-   ##
=========================================
  Coverage     88.40%   88.40%           
  Complexity        1        1           
=========================================
  Files            20       20           
  Lines           888      888           
=========================================
  Hits            785      785           
  Misses          103      103           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@norkunas norkunas force-pushed the doctrinebundlev3 branch 7 times, most recently from 240ef5f to d3be2cf Compare October 20, 2025 11:25
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 (5)
composer.json (1)

51-51: Patch‑pin phpunit‑bridge: verify tags and PHP support.

Please confirm 6.4.25 and 7.0.10 exist on Packagist and cover PHP 7.4→8.4 in your matrix. If any tag is missing, relax to the minor (e.g., ^6.4 || ^7.0) or bump to the next available patch.

tests/Kernel.php (1)

8-8: Avoid importing a class removed in v3 to keep static analysis quiet.

Drop the use Doctrine\Bundle\DoctrineBundle\Dbal\BlacklistSchemaAssetFilter; and use the FQCN in place to prevent “unknown class” warnings on v3 while preserving runtime detection.

- use Doctrine\Bundle\DoctrineBundle\Dbal\BlacklistSchemaAssetFilter;
...
-        $doctrineBundleV3 = !class_exists(BlacklistSchemaAssetFilter::class);
+        $doctrineBundleV3 = !class_exists(\Doctrine\Bundle\DoctrineBundle\Dbal\BlacklistSchemaAssetFilter::class);

Also applies to: 34-34

.github/workflows/tests.yml (3)

31-36: Set strategy fail‑fast explicitly (env var doesn’t affect matrix).

Add strategy.fail-fast to control cancellation behavior; the top-level env key has no effect.

     strategy:
+      fail-fast: false
       matrix:
         php-version: ['7.4', '8.1', '8.2', '8.3', '8.4']
         sf-version: ['5.4', '6.4', '7.0', '7.1', '7.2', '7.3']
         dependencies: ['locked']

63-65: Remove dead exclude.

Matrix doesn’t include PHP 8.0; this exclude is redundant and can be dropped.

-          - php-version: '8.0'
-            sf-version: '7.2'

93-96: Gate the sed step to non‑locked runs (and consider composer remove).

Editing composer.json while using locked deps is ineffective and may cause validate warnings. Run this only when not locked; optionally switch to composer remove for clarity.

-      - name: Remove doctrine/annotations
-        if: matrix.php-version != '7.4'
-        run: sed -i '/doctrine\/annotations/d' composer.json
+      - name: Remove doctrine/annotations
+        if: matrix.php-version != '7.4' && matrix.dependencies != 'locked'
+        run: sed -i '/doctrine\/annotations/d' composer.json
+# Or:
+# run: composer remove -n --no-update doctrine/annotations
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6957c77 and d3be2cf.

📒 Files selected for processing (10)
  • .github/workflows/tests.yml (4 hunks)
  • .php-cs-fixer.dist.php (1 hunks)
  • composer.json (2 hunks)
  • tests/Kernel.php (2 hunks)
  • tests/baseline-ignore (1 hunks)
  • tests/config/doctrine.yaml (1 hunks)
  • tests/config/doctrine_old_proxy.yaml (0 hunks)
  • tests/config/doctrine_php7.yaml (0 hunks)
  • tests/config/doctrine_v2.yaml (0 hunks)
  • tests/config/framework.yaml (1 hunks)
💤 Files with no reviewable changes (3)
  • tests/config/doctrine_v2.yaml
  • tests/config/doctrine_old_proxy.yaml
  • tests/config/doctrine_php7.yaml
✅ Files skipped from review due to trivial changes (2)
  • tests/config/doctrine.yaml
  • tests/baseline-ignore
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/config/framework.yaml
🧰 Additional context used
🧬 Code graph analysis (1)
tests/Kernel.php (1)
src/DependencyInjection/MeilisearchExtension.php (1)
  • load (19-64)
🔇 Additional comments (6)
.php-cs-fixer.dist.php (1)

16-16: ****

The ruleset name @PHP8x0Migration:risky is valid. PHP-CS-Fixer's official rulesets include @PHP8x0Migration and @PHP8x0Migration:risky, and this ruleset is part of the PHP-CS-Fixer rule set definitions. The 'x' in the middle is standard nomenclature in PHP-CS-Fixer (e.g., @PHP5x4Migration, @PHP7x0Migration, @PHP8x0Migration, @PHP8x2Migration), not a typo or error. The original review comment's concern about the ruleset being invalid or unconventional was based on incorrect assumptions about the naming pattern.

Likely an incorrect or invalid review comment.

composer.json (1)

23-23: DoctrineBundle v3 allowance looks good.

Dual constraint keeps 7.4 compatibility and enables v3 on newer PHP. No issues spotted.

tests/Kernel.php (3)

32-43: Config selection by DoctrineBundle/PHP version is clear and correct.

Framework first, then doctrine.yaml (v3) or v2/old proxy split for PHP 8+, with sane fallback. Looks good.

Please confirm tests cover all three branches: v3, v2+PHP 8.4 with LegacyReflectionFields, and the old proxy path.


45-52: PHP 7 path is pragmatic.

Inline framework tweaks + doctrine_php7.yaml load are fine for legacy runs.


55-62: Conditional ORM prepends are safely gated.

The DEFAULT_SCHEME_MAP + “not v3” guard prevents applying legacy settings on v3. LGTM.

.github/workflows/tests.yml (1)

66-77: Matrix expansion and parameterization look good.

  • “dependencies” axis + dynamic job name + composer install parameters are consistent.
  • Artifact names now unique per dependency mode.

Also applies to: 79-79, 102-104, 112-112

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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
.github/workflows/tests.yml (2)

15-15: env.fail-fast has no effect; use strategy.fail-fast instead.

Set it under the job’s strategy or remove this env var.

-env:
-  fail-fast: true
+ # (Optional) If needed, control fail-fast per job:
+ # strategy:
+ #   fail-fast: false

93-96: Scope the annotations removal to Symfony 7+.

Keying off PHP version may remove doctrine/annotations for Symfony 6.4 runs unnecessarily.

-      - name: Remove doctrine/annotations
-        if: matrix.php-version != '7.4'
+      - name: Remove doctrine/annotations for Symfony 7+
+        if: startsWith(matrix.sf-version, '7.')
         run: sed -i '/doctrine\/annotations/d' composer.json

If you want safer edits than sed, consider:

run: composer remove doctrine/annotations --no-update || true
tests/Kernel.php (1)

74-86: Fix Kernel::VERSION_ID to use the HttpKernel alias

Inside the local Kernel class, Kernel::VERSION_ID resolves to the local class (not Symfony's), but the local class doesn't define this constant. Symfony's HttpKernel defines VERSION_ID as a class constant encoding the version number. Use the imported HttpKernel alias instead:

         // @phpstan-ignore-next-line
-        if (Kernel::VERSION_ID >= 60400) {
+        if (HttpKernel::VERSION_ID >= 60400) {
             $container->prependExtensionConfig('framework', [
                 'handle_all_throwables' => true,
                 'php_errors' => ['log' => true],
             ]);
         }
         // @phpstan-ignore-next-line
-        if (Kernel::VERSION_ID >= 70300) {
+        if (HttpKernel::VERSION_ID >= 70300) {
             $container->prependExtensionConfig('framework', [
                 'property_info' => ['with_constructor_extractor' => false],
             ]);
         }
🧹 Nitpick comments (4)
.github/workflows/tests.yml (2)

25-25: Pin Meilisearch image to a tag to avoid surprise breakages.

latest can change underneath you. Prefer a major/minor tag or digest.

-        image: getmeili/meilisearch:latest
+        image: getmeili/meilisearch:v1

63-65: Redundant exclude entry.

php 8.0 isn’t part of the matrix; this exclude is dead config. Remove for clarity.

-          - php-version: '8.0'
-            sf-version: '7.2'
tests/Kernel.php (2)

8-8: Avoid importing a class removed in DoctrineBundle v3; inline FQCN in class_exists.

Prevents static analysis noise in v3 contexts.

-use Doctrine\Bundle\DoctrineBundle\Dbal\BlacklistSchemaAssetFilter;
+// Avoid importing a class missing in DoctrineBundle v3; reference FQCN inline.

And:

-        $doctrineBundleV3 = !class_exists(BlacklistSchemaAssetFilter::class);
+        $doctrineBundleV3 = !class_exists(\Doctrine\Bundle\DoctrineBundle\Dbal\BlacklistSchemaAssetFilter::class);

39-43: Confirm PHP 8.4 + LegacyReflectionFields gating.

Double-check that the doctrine_v2.yaml vs doctrine_old_proxy.yaml split strictly needs PHP >= 8.4. If the proxy-path is only for PHP < 8.4 regardless of ORM class presence, consider simplifying to a single class_exists check.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d3be2cf and dd84a5f.

📒 Files selected for processing (10)
  • .github/workflows/tests.yml (4 hunks)
  • .php-cs-fixer.dist.php (1 hunks)
  • composer.json (2 hunks)
  • tests/Kernel.php (2 hunks)
  • tests/baseline-ignore (1 hunks)
  • tests/config/doctrine.yaml (1 hunks)
  • tests/config/doctrine_old_proxy.yaml (0 hunks)
  • tests/config/doctrine_php7.yaml (0 hunks)
  • tests/config/doctrine_v2.yaml (0 hunks)
  • tests/config/framework.yaml (1 hunks)
💤 Files with no reviewable changes (3)
  • tests/config/doctrine_php7.yaml
  • tests/config/doctrine_old_proxy.yaml
  • tests/config/doctrine_v2.yaml
🚧 Files skipped from review as they are similar to previous changes (3)
  • tests/config/doctrine.yaml
  • composer.json
  • .php-cs-fixer.dist.php
🧰 Additional context used
🪛 Gitleaks (8.28.0)
tests/config/framework.yaml

[high] 3-3: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🔇 Additional comments (1)
tests/baseline-ignore (1)

11-11: Baseline entry is fine; remove once v2 path is dropped.

The ignore matches the conditional use of report_fields_where_declared for DoctrineBundle v2 only. Plan to delete this baseline when v2 support is removed to avoid masking regressions.

Confirm the message string matches exactly what the bridge emits under your CI locale.

@@ -0,0 +1,4 @@
framework:
test: true
secret: 67d829bf61dc5f87a73fd814e2c9f629
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Avoid key-like test secret to silence secret scanners.

Use a clearly non-secret value or env var to prevent gitleaks noise.

Apply one of:

-framework:
-    test: true
-    secret: 67d829bf61dc5f87a73fd814e2c9f629
-    http_method_override: false
+framework:
+    test: true
+    secret: 'test_secret_value'
+    http_method_override: false

or (if you prefer env):

-    secret: 67d829bf61dc5f87a73fd814e2c9f629
+    secret: '%env(string:default::TEST_APP_SECRET)%'

Add TEST_APP_SECRET to CI env if using the second option.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
secret: 67d829bf61dc5f87a73fd814e2c9f629
secret: '%env(string:default::TEST_APP_SECRET)%'
🧰 Tools
🪛 Gitleaks (8.28.0)

[high] 3-3: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🤖 Prompt for AI Agents
In tests/config/framework.yaml at line 3 replace the key-like secret value with
a clearly non-secret placeholder or an env var reference to avoid secret
scanners; either set secret: "test-secret" (or similar obviously fake value) or
change to secret: "${TEST_APP_SECRET}" and add TEST_APP_SECRET to CI environment
variables, ensuring no real keys are committed.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for doctrine bundle v3

1 participant