KnpLabs / DoctrineBehaviors

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

Bug in UserProvider when Symfony/Security isn't installed #456

Closed leroy0211 closed 4 years ago

leroy0211 commented 4 years ago

Version: dev-master Symfony version: 4.4

The following bug occurs if you don't have symfony/security installed.

Cannot autowire service "Knp\DoctrineBehaviors\Provider\UserProvider": argument "$security" of method "__construct()" references class "Symfony\Component\Security\Core\Security" but no such service exists.
TomasVotruba commented 4 years ago

Could you add it to composer.json? It was replaced in version 5 by https://github.com/KnpLabs/DoctrineBehaviors/blob/master/composer.json#L21

TomasVotruba commented 4 years ago

At the moment the only solutions is to install package manually explicitly.

symfony/security only exists in version 4.4, so requiring it blocks Symfony 5 install.

Have you found a better way?

TomasVotruba commented 4 years ago

Closing as there is no other way now.

See https://pehapkari.cz/blog/2019/12/23/how-we-upgraded-pehapkari-cz-from-symfony-4-to-5-in-25-days

Gabb1995 commented 4 years ago

so how do I fix this error? Install symfony/security? What if I don't need that security bundle?

All I wanted was the TimestampableTrait.

TomasVotruba commented 4 years ago

See step 4 at the bottom: https://pehapkari.cz/blog/2019/12/23/how-we-upgraded-pehapkari-cz-from-symfony-4-to-5-in-25-days