Dependency on non existent service after update to v2.2.0
Stoakes opened this issue · 8 comments
Hi,
To begin with, thank you for this bundle, which brings me comments on pages with limited efforts.
I recently updated from FosComment 2.1.0 to 2.2.0 on a Symfony 3.4 project.
After the update, I got the error:
In CheckExceptionOnInvalidReferenceBehaviorPass.php line 31:
The service "fos_comment.command.fix_aces" has a dependency on a non-existent service "security.acl.provider".
I eventually overcomed it by running composer require symfony/security-acl
and adding
# app/config/security.yml
security:
acl:
connection: default
Such change on a minor update is quite surprising, especially when used to Symfony lifecycle. Anyway, it might worth it to add a note on the 2.2.0 release page and/or the UPDATE.md to save some time for those who will get into the same issue.
Cheers
That's a bug. It should not happen.
@Stoakes I'm not fully understanding how the commands can be loaded without having ACL installed:
https://github.com/FriendsOfSymfony/FOSCommentBundle/blob/master/DependencyInjection/FOSCommentExtension.php#L60
https://github.com/FriendsOfSymfony/FOSCommentBundle/blob/master/DependencyInjection/FOSCommentExtension.php#L139
As you can see, we only load commands.xml
when ACL is enabled.
It might comes from my config which is years old.
If you want to reproduce the issue:
git clone https://github.com/n7consulting/Incipio.git
cd Incipio
git checkout v2.6.0
composer install
# dependencies update will bump Foscomment bundle to 2.2.0 and should raise the error
composer update
# Post install scripts will fail, displaying the error
So you are using ACL, but the security.acl.provider
service is not available in your project. Interesting. Can you try installing https://github.com/symfony/acl-bundle ?
Got same bug, install bundle doesn't work. FML
@XWB sorry for the delay,
Installing the acl-bundle doesn't fix the issue (error message doesn't change). However the fix in my first message still works.
So there is a workaround, the question is, is it a previous bug that is now fixed or the other way round ?
Don't know if you had a look to my configuration, but I was not using strict ACL, just role based ACL.
fos_comment:
acl_roles:
comment:
create: ROLE_SUIVEUR
view: ROLE_SUIVEUR
edit: ROLE_SUIVEUR
delete: ROLE_ADMIN
thread:
create: ROLE_SUIVEUR
view: ROLE_SUIVEUR
edit: ROLE_ADMIN
delete: ROLE_ADMIN
vote:
create: ROLE_ADMIN
view: ROLE_ADMIN
edit: ROLE_ADMIN
delete: ROLE_ADMIN
acl: true
service:
acl:
thread: fos_comment.acl.thread.roles
comment: fos_comment.acl.comment.roles
vote: fos_comment.acl.vote.roles
manager:
thread: fos_comment.manager.thread.acl
comment: fos_comment.manager.comment.acl
vote: fos_comment.manager.vote.acl
@Stoakes The package symfony/security-acl
is required if you want to use ACL. Symfony has removed ACL out of the core, so perhaps that's the reason why it cannot be found anymore. Thus the package needs to be installed separately.
As for now, the best approach I've found was to actually downgrade FOSCommentBundle to 2.1.* with "friendsofsymfony/comment-bundle": "2.1.*"
in composer.json
That is if you still want role based security AND don't want all the junk in database that enabling acl in security.yml adds in.