Bonjour,

Voila je rencontre un petit problème avec mon code. ja'i suivi la documentation pour l'installation de FOSUserBundle à part que j'ai supprimé le bundle AppBundle dans "src" et j'ai crée un bundle UserBundle où j'ai crée l'entity USER dans le dossier Entity comme l'étape 3. J'utilise symfony 3.2.13.

Ce que je fais

Je voudrais faire la mise à jour comme suggère l'étape 7. voici les differents codes app/config/config.yml , app/config/routing.yml et app/config/security.yml.

# app/config/config.yml
fos_user:
    db_driver: orm # other valid values are 'mongodb' and 'couchdb'
    firewall_name: main
    user_class: AN\UserBundle\Entity\User
    from_email:
        address: "therassonkonan@gmail.com"
        sender_name: "Thera App"

# app/config/routing.yml
fos_user:
    resource: "@FOSUserBundle/Resources/config/routing/all.xml"

newsletter:
    resource: "@NewsletterBundle/Resources/config/routing.yml"
    prefix:   /

agenda:
    resource: "@AgendaBundle/Resources/config/routing.yml"
    prefix:   /

galerie:
    resource: "@GalerieBundle/Resources/config/routing.yml"
    prefix:   /

contact:
    resource: "@ContactBundle/Resources/config/routing.yml"
    prefix:   /

user:
    resource: "@UserBundle/Resources/config/routing.yml"
    prefix:   /

post:
    resource: "@PostBundle/Resources/config/routing.yml"
    prefix:   /

core:
    resource: "@CoreBundle/Resources/config/routing.yml"
    prefix:   /

app:
    resource: '@AppBundle/Controller/'
    type: annotation

# app/config/security.yml
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

    firewalls:
        main:
            pattern: ^/
            form_login:
                provider: fos_userbundle
                csrf_token_generator: security.csrf.token_manager
                # if you are using Symfony < 2.8, use the following config instead:
                # csrf_provider: form.csrf_provider

            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 }

Ce que je veux

Mise à jour de la base de données

Ce que j'obtiens

Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\InvalidArgumentException: There is no extension able to load the configuration for "fos_user" (in C:\laragon\www\projetAgenumerique\app/config\config.yml). Looked for namespace "fos_user", found "framework", "security", "twig", "monolog", "swiftmailer", "doctrine", "sensio_framework_extra", "core", "post", "user", "contact", "galerie", "agenda", "newsletter", "debug", "web_profiler", "sensio_distribution" in C:\laragon\www\projetAgenumerique\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\Loader\YamlFileLoader.php:431
Stack trace:

0 C:\laragon\www\projetAgenumerique\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\Loader\YamlFileLoader.php(401): Symfony\Component\DependencyInjection\Loader\YamlFileLoader->validate(Array, 'C:\laragon\www\...') 1 C:\laragon\www\projetAgenumerique\vendor\symfony\symfony\src\Symfony\Component\DependencyInjection\Loader\YamlFileLoader.php(69): Symfony\Component\DependencyInjection\Loader in C:\laragon\www\projetAgenumerique\vendor\symfony\symfony\src\Symfony\Component\Config\Loader\FileLoader.php on line 118

1 réponse


SimonAndGarfunkel
Réponse acceptée

Bonjour Lexis,

As-tu bien ajouté le bundle dans le fichier app/AppKernel.php ? On dirait que le bundle n'est pas chargé... (étape n°2)