PUGX / PUGXMultiUserBundle

An extension for FOSUserBundle to handle users of different types. Compatible with Doctrine ORM.
163 stars 96 forks source link

Service issue FOSUserBundle / PUGXMultiUserBundle Symfony #142

Closed TouchForDiffusion closed 7 years ago

TouchForDiffusion commented 7 years ago

Hello,

I have a problem for integrate PUGXMultiUserBundle in Symfony.

Error message : The service "pugx_user.manager.orm_user_manager" has a dependency on a non-existent service "fos_user.util.password_updater".

Can you help me please ?

composer.json

    "php": ">=5.3.9",
    "symfony/symfony": "2.8.*",
    "doctrine/orm": "^2.4.8",
    "doctrine/doctrine-bundle": "~1.4",
    "friendsofsymfony/user-bundle": "~2.0@dev",
    "pugx/multi-user-bundle": "3.0.*@dev",
    "hwi/oauth-bundle": "^0.5.3"

config.yml

    fos_user:
        db_driver: orm
        firewall_name: main
        user_class: UserBundle\Entity\User
        service:
            user_manager: pugx_user_manager
        from_email:
            address: "%mailer_user%"
            sender_name: "%mailer_user%"
        registration:
            form:
                type: app_user_registration
            confirmation:
                enabled: false

    pugx_multi_user:
      users:
        user_one:
            entity: 
                class: AppBundle\Entity\CollaboratorBase
            registration:
                form: 
                    type: UserBundle\Form\RegistrationFormType
                    name: fos_user_registration_form
                    validation_groups:  [Registration, Default]
                template: UserBundle:Registration:register.html
            profile:
                form:
                    type: UserBundle\Form\Type\ProfileFormType
                    name: fos_user_profile_form
                    validation_groups:  [Profile, Default]

    services:
        fos_user.doctrine_registry:
            alias: doctrine

PUGX\MultiUserBundle\Resources\config\orm.yml

    services:
        # custom fosuser user manager    
        pugx_user.manager.orm_user_manager:
            class:     PUGX\MultiUserBundle\Doctrine\UserManager
            arguments: ["@fos_user.util.password_updater", "@fos_user.util.canonical_fields_updater", "@fos_user.object_manager", "%fos_user.model.user.class%", "@pugx_user.manager.user_discriminator"]

        pugx_user_manager:
            alias: pugx_user.manager.orm_user_manager
garak commented 7 years ago

See #98

TouchForDiffusion commented 7 years ago

Thank you but Issue #98 not resolve my problem.

After update orm.yml, the new error message is : The service "pugx_user.manager.orm_user_manager" has a dependency on a non-existent service "fos_user.object_manager".

garak commented 7 years ago

So, don't use fos_user.object_manager

TouchForDiffusion commented 7 years ago

With orm.yml

services:
    # custom fosuser user manager    
    pugx_user.manager.orm_user_manager:
        class:     PUGX\MultiUserBundle\Doctrine\UserManager
        arguments: ["@security.encoder_factory", "@fos_user.util.username_canonicalizer", "@fos_user.util.email_canonicalizer", %fos_user.model.user.class%, "@pugx_user.manager.user_discriminator"]

    pugx_user_manager:
        alias: pugx_user.manager.orm_user_manager

Catchable Fatal Error: Argument 1 passed to PUGX\MultiUserBundle\Doctrine\UserManager::__construct() must be an instance of FOS\UserBundle\Util\PasswordUpdaterInterface, instance of Symfony\Component\Security\Core\Encoder\EncoderFactory given, called in app\cache\dev\appDevDebugProjectContainer.php on line 2851 and defined

garak commented 7 years ago

That's already mentioned by other users, no one else complained about the solution mentioned in #98