DoctrineExtensions icon indicating copy to clipboard operation
DoctrineExtensions copied to clipboard

[Timestampable] Prevent deprecated ArrayAccess on FieldMapping in doctrine/orm 3

Open cngJo opened this issue 1 year ago • 2 comments

During an upgrade to doctrine/orm 3 together with gedmo/doctrine-extensions 3.16.1, I noticed a lot of deprecation messages that seem to originate in this package, rather than my application code ;)

I verified this change by applying a non-backwards compatible version to in my vendor directory directly, and the deprecation messages went away.


I introduced a small helper method to avoid code duplication around the instanceof check. This can be removed when support for doctrine/orm 2 is dropped somewhere in the future and replaced with:

-$this->getType($mapping);
+$mapping->type;

cngJo avatar Jul 01 '24 21:07 cngJo

Ah sorry ... I just found #2827 after the fact. Feel free to just close this PR if you're not interested in this change 🙂

cngJo avatar Jul 01 '24 21:07 cngJo

Feel free to just close this PR if you're not interested in this change 🙂

The issue isn't necessarily whether we're interested in this type of change or not, but with as widespread as use of the mapping data in this package is, and how it needs to account for at least 3 different shapes (ORM 2.x arrays, ORM 3.x objects, and ODM 2.x arrays), my personal feeling is it just ends up adding a lot of code to this package which affects runtime performance with the only benefit of (trying to) be deprecation-free on a new install/update, especially as similar conditionals have to be introduced in a few dozen places. That's the reason I just used https://github.com/doctrine-extensions/DoctrineExtensions/issues/2827#issuecomment-2188696396 to not have to think about it in my own applications.

mbabker avatar Jul 01 '24 22:07 mbabker

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Feb 14 '25 09:02 github-actions[bot]

This was fixed with https://github.com/doctrine-extensions/DoctrineExtensions/pull/2889, so this PR is no longer needed.

cngJo avatar Feb 18 '25 22:02 cngJo