I'm trying to implement ACL to restric comments on FOSCommentBundle to users role. I followed step by step the Bundles Doc but shows me an error:
The definition for "acl" has no class.
Thats my app/config/config.yml
fos_comment:
db_driver: orm
class:
model:
comment: BackEndBundle\Entity\Comment
thread: BackEndBundle\Entity\Thread
vote: BackEndBundle\Entity\Vote
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
acl_roles:
comment:
create: IS_AUTHENTICATED_ANONYMOUSLY
view: IS_AUTHENTICATED_ANONYMOUSLY
edit: ROLE_ADMIN
delete: ROLE_ADMIN
thread:
create: IS_AUTHENTICATED_ANONYMOUSLY
view: IS_AUTHENTICATED_ANONYMOUSLY
edit: ROLE_ADMIN
delete: ROLE_ADMIN
vote:
create: IS_AUTHENTICATED_ANONYMOUSLY
view: IS_AUTHENTICATED_ANONYMOUSLY
edit: ROLE_ADMIN
delete: ROLE_ADMIN
assetic:
bundles: [ "FOSCommentBundle" ]
I thought that symfony3 didn't have the ACL installed so i tried to with commands but gives me the same error "The definition for "acl" has no class".
Thats my app/config/services.yml
parameters:
services:
acl:
connection: default
You don't have to add ACL configuration to app/config/services.yml. The bundle, FOSCommentBundle in this case, has its own config file for services.
Just install the bundle via Composer and add the bundle into AppKernel.php
$bundles = [
...
new FOS\CommentBundle\FOSCommentBundle(),
...
If you have done all above, just remove the acl: connection: default
from app/config/services.yml and it should work. You can check if there are FOSCommentBundle services available by bin\console debug:container fos_comment
.