sonata-project / EntityAuditBundle

Audit for Doctrine Entities
https://sonata-project.org
MIT License
633 stars 261 forks source link

Add `doctrine/orm` 3 support #590

Closed franmomu closed 4 months ago

franmomu commented 1 year ago

Subject

This PR tries to add support for doctrine/orm 3

I am targeting this branch, because these changes are BC.

Changelog

### Added
- Support for `doctrine/orm` 3

The CI should be modified to allow installing doctrine/orm 3

franmomu commented 1 year ago

We need https://github.com/doctrine/data-fixtures/pull/452

greg0ire commented 1 year ago

The next blocker seems to be https://github.com/doctrine-extensions/DoctrineExtensions/issues/2708

franmomu commented 1 year ago

The next blocker seems to be doctrine-extensions/DoctrineExtensions#2708

Yep, that would take a bit longer I think, I'll try to help with that

VincentLanglet commented 7 months ago

Hi @franmomu, what about following the same strategy than https://github.com/sonata-project/SonataDoctrineORMAdminBundle/blob/4.x/.github/workflows/test_orm_3.yaml ?

gedmo/doctrine-extensions is an optional dev dependency, it should be a blocker for the ORM 3 support.

amacrobert-meq commented 6 months ago

Is there anything I can do to help this PR along? This bundle is holding up an ORM upgrade on our end, so I'm happy to help if I can.

VincentLanglet commented 6 months ago

Is there anything I can do to help this PR along? This bundle is holding up an ORM upgrade on our end, so I'm happy to help if I can.

Basically, we need green tests.

If you want you can recreate the same PR and add a github actions similar to https://github.com/sonata-project/SonataDoctrineORMAdminBundle/blob/4.x/.github/workflows/test_orm_3.yaml

Instead of removing AuditBundle you remove the doctrineExtensions.

franmomu commented 5 months ago

I found some time to try to work on this, I've tried to remove some deprecations (related to accessing new mapping objects as array), but there should be more.

Not sure if I can keep working on this in the following days, so if anyone wants to continue with this, feel free to do it.

franmomu commented 5 months ago

I think this is ready to be reviewed, the SimpleThings\EntityAudit\Utils\ORMCompatibilityTrait tries to avoid deprecations triggered by ORM 3 accessing to mapping objects as array.

At first, I've used a getMappingValue method for almost everything, and then I've starting using specific methods (getMappingColumnNameValue, getMappingNameValue, etc) to be able to be more specific about types.

VincentLanglet commented 5 months ago

Do you want me to merge/release or should we wait ? @franmomu

franmomu commented 4 months ago

since I've change some things, it would be nice to have another approval, I've requested reviews 🤞

phansys commented 4 months ago

Thank you @franmomu!

VincentLanglet commented 4 months ago

Go for the release https://github.com/sonata-project/EntityAuditBundle/pull/628