Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: resolve Doctrine ORM deprecation warnings for ORM 3.0 compatibility (#11)#27

Merged
mkldevops merged 1 commit into
mainfrom
feature/issue-11-fix-doctrine-orm-deprecations
Sep 13, 2025
Merged

fix: resolve Doctrine ORM deprecation warnings for ORM 3.0 compatibility (#11)#27
mkldevops merged 1 commit into
mainfrom
feature/issue-11-fix-doctrine-orm-deprecations

Conversation

@mkldevops
Copy link
Copy Markdown
Owner

Summary

Fixes three Doctrine ORM deprecation warnings to prepare for ORM 3.0 compatibility. These are configuration-only changes that maintain backward compatibility while addressing future breaking changes.

Deprecation Warnings Resolved

1. MySQL Version Detection ✅

Problem: Version detection logic for MySQL will change in DBAL 4
Solution: Changed server_version: "8" to server_version: "8.0.31"
Impact: Prevents version detection issues in DBAL 4.0

2. Lazy Ghost Objects ✅

Problem: Not enabling lazy ghost objects is deprecated and will not be supported in Doctrine ORM 3.0
Solution: Added enable_lazy_ghost_objects: true
Impact: Required for ORM 3.0, improves lazy loading performance

3. AttributeDriver Field Reporting ✅

Problem: In ORM 3.0, the AttributeDriver will report fields for the classes where they are declared
Solution: Added report_fields_where_declared: true
Impact: Enables new ORM 3.0 field reporting mode, may reveal invalid mappings

Technical Details

Configuration Changes in config/packages/doctrine.yaml:

doctrine:
    dbal:
        server_version: "8.0.31"  # Was "8"
    orm:
        enable_lazy_ghost_objects: true  # NEW
        entity_managers:
            default:
                report_fields_where_declared: true  # NEW

Benefits

  • Future Compatibility: Prepares application for Doctrine ORM 3.0 upgrade
  • Performance: Lazy ghost objects provide better memory usage and performance
  • Code Quality: New field reporting may uncover mapping configuration issues
  • No Breaking Changes: All changes maintain backward compatibility

Risk Assessment

  • Risk Level: Very Low
  • Configuration Only: No code changes, only YAML configuration
  • Backward Compatible: All settings work with current ORM version
  • Reversible: Changes can be easily reverted if issues arise

Testing

  • PHPStan Analysis: ✅ No errors
  • Configuration Syntax: ✅ Valid YAML structure
  • Pre-commit Hooks: ✅ All validations pass
  • Schema Validation: ✅ Doctrine configuration accepted

Validation

The configuration changes are purely additive and enable recommended settings for ORM 3.0 compatibility:

Setting Current ORM ORM 3.0 Compatibility
server_version: "8.0.31" ✅ Works ✅ Required ✅ Compatible
enable_lazy_ghost_objects: true ✅ Works ✅ Required ✅ Compatible
report_fields_where_declared: true ✅ Works ✅ Default ✅ Compatible

References

Closes #11

…ity (#11)

Address three deprecation warnings to prepare for Doctrine ORM 3.0:

1. MySQL Version Specification:
   - Change server_version from '8' to '8.0.31' for explicit version detection
   - Prevents DBAL 4.0 version detection logic deprecation warning

2. Lazy Ghost Objects:
   - Enable lazy ghost objects with 'enable_lazy_ghost_objects: true'
   - Required for ORM 3.0 compatibility, improves performance

3. AttributeDriver Field Reporting:
   - Configure 'report_fields_where_declared: true'
   - Enables new ORM 3.0 field reporting mode for better mapping validation
   - May uncover invalid mapping configurations that need fixing

These changes maintain backward compatibility while preparing the
application for future Doctrine ORM upgrades.
@github-actions
Copy link
Copy Markdown

🐳 Docker Image Built Successfully

Image Tags:

ghcr.io/mkldevops/education-legacy:pr-27
ghcr.io/mkldevops/education-legacy:pr-27-035e275

Pull Command:

docker pull ghcr.io/mkldevops/education-legacy:pr-27-035e2756f6333003b8ac2874a008482c9234bce8

Run Command:

docker run -p 3900:80 ghcr.io/mkldevops/education-legacy:pr-27-035e2756f6333003b8ac2874a008482c9234bce8

✅ Ready for testing!

@mkldevops mkldevops merged commit 5b6882f into main Sep 13, 2025
12 of 13 checks passed
@mkldevops mkldevops deleted the feature/issue-11-fix-doctrine-orm-deprecations branch September 13, 2025 21:18
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.

Fix Doctrine ORM deprecation warnings for ORM 3.0 compatibility

1 participant