KnpLabs / DoctrineBehaviors

Doctrine2 behavior traits that help handling Blameable, Loggable, Sluggable, SoftDeletable, Uuidable, Timestampable, Translatable, Tree behavior
http://knplabs.com
MIT License
913 stars 293 forks source link

Fix SF62 / SF63 deprecations (doctrine subscriber deprecated) #738

Open raziel057 opened 1 year ago

raziel057 commented 1 year ago

Fix deprecation raised when using doctrine/doctrine-bundle starting from v2.10 (see https://github.com/doctrine/DoctrineBundle/commit/656beec9a163b44987a7e79f89f74020d0358b17).

On my test suite (~400 tests) the deprecation is raised 7497x:

Remaining indirect deprecation notices (7497x)

833x: Since symfony/doctrine-bridge 6.3: Registering "Knp\DoctrineBehaviors\EventSubscriber\BlameableEventSubscriber" as a Doctrine subscriber is deprecated. Regisr it as a listener instead, using e.g. the #[AsDoctrineListener] attribute.
...
833x: Since symfony/doctrine-bridge 6.3: Registering "Knp\DoctrineBehaviors\EventSubscriber\LoggableEventSubscriber" as a Doctrine subscriber is deprecated. Regisr it as a listener instead, using e.g. the #[AsDoctrineListener] attribute.
...
833x: Since symfony/doctrine-bridge 6.3: Registering "Knp\DoctrineBehaviors\EventSubscriber\SluggableEventSubscriber" as a Doctrine subscriber is deprecated. Regisr it as a listener instead, using e.g. the #[AsDoctrineListener] attribute.
Since symfony/doctrine-bridge 6.3: Using Doctrine subscribers as services is deprecated, declare listeners instead

The test suite have been run locally after the change and I could fix :

image

Fix first part of https://github.com/KnpLabs/DoctrineBehaviors/issues/737

SimonVanacco commented 1 year ago

Is there any plans to merge this PR? The code looks good and it would prevent an issue with Symfony 7 in november !

If there's anything to do to help let me know

raziel057 commented 1 year ago

@SimonVanacco Hello, while waiting for the integration of PR for the fixes of deprecations on PHP 8.2 and SF6.3 you can try to reference my repository. Let me know if all is fine:


"repositories" : [{
    "type" : "vcs",
    "url" : "https://github.com/raziel057/DoctrineBehaviors"
}],
"require" : {
    ...
    "knplabs/doctrine-behaviors": "dev-master",
    ....
}
tacman commented 1 year ago

Thanks, @raziel057, the deprecation errors were filling the logs and making it difficult to see the important errors.

BTW, here's a CLI way of using your fork.

composer config repositories.doctrine_behaviors '{"type": "vcs", "url": "https://github.com/raziel057/DoctrineBehaviors"}'
composer req knplabs/doctrine-behaviors:dev-master
SimonVanacco commented 11 months ago

@SimonVanacco Hello, while waiting for the integration of PR for the fixes of deprecations on PHP 8.2 and SF6.3 you can try to reference my repository. Let me know if all is fine:

"repositories" : [{
  "type" : "vcs",
  "url" : "https://github.com/raziel057/DoctrineBehaviors"
}],
"require" : {
    ...
    "knplabs/doctrine-behaviors": "dev-master",
    ....
}

I tested a bit and had zero issues so far - and the deprecations were indeed gone ! Nice work !

tonyaxo commented 9 months ago

@TomasVotruba could you please review and merge this PR?

garak commented 7 months ago

Gentle bump

benoit-outsourcify commented 5 months ago

Hi, any news?