-
Notifications
You must be signed in to change notification settings - Fork 33
Add support for doctrine bundle v3 #400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds 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
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
0a4e91a
to
9c4efad
Compare
There was a problem hiding this 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
📒 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.
be47be4
to
2db723c
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
240ef5f
to
d3be2cf
Compare
d3be2cf
to
dd84a5f
Compare
There was a problem hiding this 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
📒 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
There was a problem hiding this 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.jsonIf you want safer edits than sed, consider:
run: composer remove doctrine/annotations --no-update || truetests/Kernel.php (1)
74-86
: FixKernel::VERSION_ID
to use theHttpKernel
aliasInside 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 importedHttpKernel
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
📒 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.
Pull Request
Related issue
Fixes #399
What does this PR do?
PR checklist
Please check if your PR fulfills the following requirements:
Summary by CodeRabbit
New Features
Tests
Chores