Dan Belden
Dan Belden

Reputation: 1217

Symfony2 - Missing parent definition "doctrine.orm.security.user.provider"

I'm currently having some frustration trying to implement the Symfony2 cookbook for creating a custom user provider utilising doctrine: http://symfony.com/doc/2.0/cookbook/security/entity_provider.html

Here is my security.yml file:

security:
    encoders:
        Rep\Bundle\ProjectBundle\Model\User:
            algorithm:        sha1
            encode_as_base64: false
            iterations:       1

    role_hierarchy:
        ROLE_USER:        ROLE_USER
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: [ ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH ]

    providers:
        user_db:
            entity: { class: ProjectBundle:User, property: username }

    firewalls:
        admin_area:
            pattern:    ^/admin
            http_basic: ~

    access_control:
        - { path: ^/admin, roles: ROLE_ADMIN }

Here is my error:

Obvious questions:

  1. Do I have doctrine installed? Yes. And Registered in the kernel.
  2. Have I created the user interface and provider. Yes.

Also, I am choosing to build this instead of using the FOSUserBundle as it's too "bulky" for what I need, so any help would be ideal!

Upvotes: 2

Views: 1818

Answers (1)

Dan Belden
Dan Belden

Reputation: 1217

Problem was caused by missing configuration information for doctrine, however the bundle was registered in the kernel. Strange error message which doesn't point towards lacking config, but process of elimination resolved my issue.

Upvotes: 2

Related Questions