FriendsOfSymfony / FOSUserBundle

Provides user management for your Symfony project. Compatible with Doctrine ORM & ODM, and custom storages.

Home Page:https://symfony.com/doc/master/bundles/FOSUserBundle/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The service "fos_user.resetting.controller" has a dependency on a non-existent service "templating"

cmukanisa opened this issue · comments

How can i configure FOSUser Bundle Using SYMFONY 4.1 because it's create much errors

which version of FOSUserBundle are you using ?

I'm using version 2.1.2

what would I do at this stage

You've to add the following to the config/packages/framework.yaml:

framework:
    # ... other stuff ...
    
    templating:
        engines: ['twig', 'php']

I already did, but the problem still lingers

Needed deps installed?
composer require annotations doctrine migrations twig translations

And cache cleared? (php bin/console cache:clear)

What's the exact error message?

the error message changes to

The service "security.authentication.provider.dao.main" has a dependency on a non-existent service "fos_user.user_checker".

and here is my configuration
`security:
encoders:
FOS\UserBundle\Model\UserInterface: bcrypt

role_hierarchy:
    ROLE_ADMIN:       ROLE_USER
    ROLE_SUPER_ADMIN: ROLE_ADMIN

providers:
    fos_userbundle:
        # id: fos_user.user_provider.username
        id: fos_user.user_provider.username_email

firewalls:
    dev:
        pattern: ^/(_(profiler|wdt)|css|images|js)/
        security: false

    main:
        pattern: ^/
        user_checker: fos_user.user_checker
        form_login:
            provider: fos_userbundle
            csrf_token_generator: security.csrf.token_manager

        logout:       true
        anonymous:    true

access_control:
    - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/admin/, role: ROLE_ADMIN }`

the big problem is that when I put
main: pattern: ^/ user_checker: fos_user.user_checker ...

Help Please

Hi, you need to change
user_checker: fos_user.user_checker
to
user_checker: security.user_checker
Duplicate of #2855

@christiankasse @stof How about close this ticket?

this should be added to the documentation… I keep running into the same issues because the docs aren't up to date

commented

I've just created a new Symfony 3.4 project and installed FOSUserBundle 2.1 and I had the same issue too.
Please, correct the documentation.

I'm wondering if the original issue here perhaps needs to be reopened in preparation for Symfony 5. Since the templating component integration is removed in Symfony 5, I've followed these steps in an attempt to fix a deprecation warning related to the templating component.

However, when I do, the following error is thrown:

The service "fos_user.resetting.controller" has a dependency on a non-existent service "templating".

It's not clear to me what's causing the error though, as I can see no templating dependency in the fos_user.resetting.controller service definition. Perhaps the problem is that the entire service_container is being set on the controller?

A year later, problem still exists?.... I just updated a symfony 3.4 app to symfony 4.4 and I am getting this error. I have no idea how to even debug it.

More specifically, setting the proper mailing implementation setting, which is used by the resetting controller (among other) and is somehow related to a direct injection of @templating.

fos_user:
# [...]
    service:
        mailer: fos_user.mailer.twig_swift    

More specifically, setting the proper mailing implementation setting, which is used by the resetting controller (among other) and is somehow related to a direct injection of @templating.

fos_user:
# [...]
    service:
        mailer: fos_user.mailer.twig_swift    

This resolved my issue