fix(doctrine): avoid deprecated ArrayAccess on FieldMapping in DoctrineORMListener#506
Open
HecFranco wants to merge 1 commit into
Open
fix(doctrine): avoid deprecated ArrayAccess on FieldMapping in DoctrineORMListener#506HecFranco wants to merge 1 commit into
HecFranco wants to merge 1 commit into
Conversation
- Updated field mapping logic to support both legacy array mapping and the new FieldMapping object introduced in Doctrine ORM 3.x. - Ensured backward compatibility with existing implementations while preparing for future ORM 4.0 changes.
Contributor
Author
|
Thanks for maintaining LexikTranslationBundle — it would be great if one of the maintainers could review this PR when you have a moment. Happy to adjust anything based on your feedback. |
Contributor
Author
|
Hi maintainers, Just following up on this PR. It addresses the Doctrine ORM 3.x deprecation caused by using ArrayAccess on The change keeps the existing behavior intact while making the metadata access compatible with the newer Doctrine mapping API, and it also closes #491. Would it be possible to review or merge this when you have a chance? Happy to make any adjustments if needed. Thanks again for maintaining this bundle. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix Doctrine ORM 3 FieldMapping ArrayAccess deprecation
This PR fixes a Doctrine ORM 3.x deprecation triggered when accessing
FieldMappingmetadata using array syntax.Doctrine ORM deprecated
ArrayAccessonDoctrine\ORM\Mapping\FieldMappingindoctrine/orm#11211, and this behavior is expected to be removed in ORM 4.0.As a result, code like this:
can trigger the following deprecation notice:
Context
The deprecation is currently triggered in
DoctrineORMListener::loadClassMetadata, where the bundle checks the mapped field type before adjusting the length of string fields for MySQL connections using theutf8mb4charset.The existing behavior is preserved:
stringare considered;191when the connection charset isutf8mb4.What changed
This PR replaces direct array access to the Doctrine field mapping with a small helper method that resolves the field type safely from either:
Doctrine\ORM\Mapping\FieldMappingobject, using its publictypeproperty;typekey.This keeps the code compatible with Doctrine ORM 3.x while remaining tolerant of array-based metadata mappings.
Why
This removes the Doctrine ORM 3.x deprecation notice and prepares this part of the bundle for Doctrine ORM 4 compatibility, without changing the existing behavior of the metadata adjustment logic.
Tests
Not run locally. The change is limited to metadata mapping access and preserves the existing logic.
Fixes #491.