Bonjour,
Actuellement j'essaye de relier FosUserBundle dans Sonata et je n'arrive pas à trouver . Je précide que Fosuserbundle et sonata fonctionne mais si je veux relier les deux j'ai :

There is no extension able to load the configuration for "sonata_user" (in C:\wamp64\www\...\app/config\config.yml). Looked for namespace "sonata_user", found "framework", "security", "twig", "monolog", "swiftmailer", "doctrine", "sensio_framework_extra", "..._user", "fos_user", "sonata_core", "sonata_block", "knp_menu", "sonata_doctrine_orm_admin", "sonata_admin", "sonata_easy_extends", "debug", "web_profiler", "sensio_distribution" in C:\wamp64\www\...\app/config\config.yml (which is being imported from "C:\wamp64\www\...\app/config/config_dev.yml").
Il ne trouve pas sonata_user: de mon config.yml

mon config.yml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
 
imports:
    - { resource: parameters.yml }
    - { resource: security.yml }
    - { resource: services.yml }
    - { resource: "@SonataUserBundle/Resources/config/services.yml" }
 
# Put parameters here that don't need to change on each machine where the app is deployed
# http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
    locale: fr
 
framework:
    #esi:             ~
    translator:      ~
    secret:          "%secret%"
    router:
        resource: "%kernel.root_dir%/config/routing.yml"
        strict_requirements: ~
    form:            ~
    csrf_protection:
    validation:      { enable_annotations: true }
    #serializer:      { enable_annotations: true }
    templating:
        engines: ['twig']
    default_locale:  "%locale%"
    trusted_hosts:   ~
    trusted_proxies: ~
    session:
        # http://symfony.com/doc/current/reference/configuration/framework.html#handler-id
        handler_id:  session.handler.native_file
        save_path:   "%kernel.root_dir%/../var/sessions/%kernel.environment%"
    fragments:       ~
    http_method_override: true
    assets: ~
 
 
# Twig Configuration
twig:
    debug:            "%kernel.debug%"
    strict_variables: "%kernel.debug%"
    form_themes:
      #  - bootstrap_3_layout.html.twig
        - bootstrap_3_horizontal_layout.html.twig
 
# Doctrine Configuration
doctrine:
    dbal:
        driver:   pdo_mysql
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"
        charset:  UTF8
        # if using pdo_sqlite as your database driver:
        #   1. add the path in parameters.yml
        #     e.g. database_path: "%kernel.root_dir%/data/data.db3"
        #   2. Uncomment database_path in parameters.yml.dist
        #   3. Uncomment next line:
        #     path:     "%database_path%"
 
    orm:
        auto_generate_proxy_classes: "%kernel.debug%"
        naming_strategy: doctrine.orm.naming_strategy.underscore
        auto_mapping: true
 
# Swiftmailer Configuration
swiftmailer:
    transport: "%mailer_transport%"
    host:      "%mailer_host%"
    username:  "%mailer_user%"
    password:  "%mailer_password%"
    spool:     { type: memory }
 
 
# fosuser configuration
 
fos_user:
    db_driver: orm
    firewall_name: main
    user_class:     Sonata\UserBundle\Entity\BaseUser
 
    group:
        group_class:   Sonata\UserBundle\Entity\BaseGroup
        group_manager: sonata.user.orm.group_manager                    # If you're using doctrine orm (use sonata.user.mongodb.user_manager for mongodb)
    service:
        user_manager: sonata.user.orm.user_manager                      # If you're using doctrine orm (use sonata.user.mongodb.group_manager for mongodb)
        mailer: fos_user.mailer.twig_swift
    registration:
        confirmation:
#template pour l’envoi de mail vérification de compte
            template: ...UserBundle:Email:index.email.twig
            enabled:    true
            from_email:
                # Adresse de l'expediteur
                address: ..@gmail.com
                # Nom de l'expediteur
                sender_name: Admin
                # déclaration du nouveau formulaire
        form:
            type: ...\UserBundle\Form\RegistrationType
                # ajoute du formulaire de la modification du profil
    profile:
        form:
            type: ...\UserBundle\Form\ProfileFormType
 
sonata_user:
    security_acl: true
    manager_type: orm # can be orm or mongodb
 
sonata_block:
    blocks:
        sonata.user.block.menu:    # used to display the menu in profile pages
        sonata.user.block.account: # used to display menu option (login option)
        sonata.block.service.text: # used to if you plan to use Sonata user routes
 
doctrine:
    dbal:
        types:
            json: Sonata\Doctrine\Types\JsonType
mon security.yml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 
# To get started with security, check out the documentation:
# http://symfony.com/doc/current/book/security.html
security:
    acl:
        connection: default
    encoders:
        FOS\UserBundle\Model\UserInterface: bcrypt
 
    # http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
    role_hierarchy:
        ROLE_ADMIN:       [ROLE_USER, ROLE_SONATA_ADMIN]
        ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
        SONATA:
            - ROLE_SONATA_PAGE_ADMIN_PAGE_EDIT  # if you are using acl then this line must be commented
 
    providers:
        fos_userbundle:
            id: fos_user.user_manager
 
    firewalls:
        # Disabling the security for the web debug toolbar, the profiler and Assetic.
        dev:
            pattern:  ^/(_(profiler|wdt)|css|images|js)/
            security: false
 
        # -> custom firewall for the admin area of the URL
        admin:
            pattern:            /admin(.*)
            context:            user
            form_login:
                provider:       fos_userbundle
                login_path:     /admin/login
                use_forward:    false
                check_path:     /admin/login_check
                failure_path:   null
            logout:
                path:           /admin/logout
            anonymous:          true
 
        # -> end custom configuration
 
        # default login area for standard users
 
        # This firewall is used to handle the public login area
        # This part is handled by the FOS User Bundle
        main:
            pattern:             .*
            context:             user
            form_login:
                provider:       fos_userbundle
                login_path:     /login
                use_forward:    false
                check_path:     /login_check
                failure_path:   null
            logout:             true
            anonymous:          true
 
    access_control:
        # URL of FOSUserBundle which need to be available to anonymous users
        - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
 
        # Admin login page needs to be accessed without credential
        - { path: ^/admin/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/admin/logout$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/admin/login_check$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/admin/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
 
        # Secured part of the site
        # This config requires being logged for the whole site and having the admin role for the admin part.
        # Change these rules to adapt them to your needs
        - { path: ^/admin/, role: [ROLE_ADMIN, ROLE_SONATA_ADMIN] }
        - { path: ^/.*, role: IS_AUTHENTICATED_ANONYMOUSLY }
Mon app/routing.yml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
 
sonata_user:
    resource: "@SonataUserBundle/Resources/config/routing.yml"
    prefix:   /
 
 
oxyjob_user:
    resource: "@OxyjobUserBundle/Resources/config/routing.yml"
    prefix:   /
 
app:
    resource: "@AppBundle/Controller/"
    type:     annotation
fos_user:
    resource: "@FOSUserBundle/Resources/config/routing/all.xml"
 
    admin:
    resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
    prefix: /admin
 
_sonata_admin:
    resource: .
    type: sonata_admin
    prefix: /admin
 
sonata_user_security:
    resource: "@SonataUserBundle/Resources/config/routing/sonata_security_1.xml"
 
sonata_user_resetting:
    resource: "@SonataUserBundle/Resources/config/routing/sonata_resetting_1.xml"
    prefix: /resetting
 
sonata_user_profile:
    resource: "@SonataUserBundle/Resources/config/routing/sonata_profile_1.xml"
    prefix: /profile
 
sonata_user_register:
    resource: "@SonataUserBundle/Resources/config/routing/sonata_registration_1.xml"
    prefix: /register
 
sonata_user_change_password:
    resource: "@SonataUserBundle/Resources/config/routing/sonata_change_password_1.xml"
    prefix: /profile
 
sonata_user:
    resource: '@SonataUserBundle/Resources/config/routing/admin_security.xml'
    prefix: /admin

Merci d'avance
Laurent