Search code examples
phpsymfonyfosuserbundlepugxmultiuserbundle

Dependency service issue with PUGX multi user in symfony


I'm currently working on a symfony project that I have to finish to end my degree.

I wanted to create two kinds of users for my site so I installed PUGX which was the most popular and easy to use. I followed the documentation on github to achieve the installation but I'm stuck since two days now and I cant really find the solution.

I get this error when I want to go on my index page :

ServiceNotFoundException in
CheckExceptionOnInvalidReferenceBehaviorPass.php line 58:
The service "pugx_user.manager.orm_user_manager" has a dependency on a non-existent service "fos_user.util.password_updater".
As you can see I'm using FOSUserBundle as well.

I don't really know what that means, I didn't find anything about it on forums and stuff.

Feel free to ask my files if you want to take a look and i will add them to the topic.

Im adding the main config one below :

**app/config/config.yml**

    # FOS user config
    fos_user:
        db_driver: orm
        firewall_name: main
        user_class: Utilisateurs\UtilisateursBundle\Entity\Utilisateurs
        service:
            user_manager: pugx_user_manager

    # PUGXmultiuser config
    pugx_multi_user:
      users:
        Client:
            entity: 
              class: Utilisateurs\UtilisateursBundle\Entity\Client
            registration:
              form: 
                type: Utilisateurs\UtilisateursBundle\Form\Type\RegistrationClientFormType
                name: fos_user_registration_form
                validation_groups:  [Registration, Default]
              template: UtilisateursUtilisateursBundle:views:Registration:Client.html.twig
            profile:
              form:
                type: Utilisateurs\UtilisateursBundle\Form\Type\ProfileClientFormType
                name: fos_user_profile_form
                validation_groups:  [Profile, Default] 

        Moniteur:
            entity: 
              class: Utilisateurs\UtilisateursBundle\Entity\Moniteur
            registration:
              form: 
                type: Utilisateurs\UtilisateursBundle\Form\RegistrationMoniteurFormType
              template: UtilisateursUtilisateursBundle:views:Registration:Moniteur.html.twig
            profile:
              form: 
                type: Utilisateurs\UtilisateursBundle\Form\Type\ProfileMoniteurFormType

thanks for your help in advance!

EDIT :

There is what i have on my console :

[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
  The service "pugx_user.manager.orm_user_manager" has a dependency on a non-existent service "f
  os_user.util.password_updater".

there is my composer.json file as well :

{
    "name": "symfony/framework-standard-edition",
    "license": "MIT",
    "type": "project",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-4": { "": "src/" },
        "classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
    },
    "require": {
        "php": ">=5.3.9",
        "symfony/symfony": "2.8.*",
        "doctrine/orm": "^2.4.8",
        "doctrine/doctrine-bundle": "~1.4",
        "symfony/swiftmailer-bundle": "~2.3,>=2.3.10",
        "symfony/monolog-bundle": "^3.0.2",
        "sensio/distribution-bundle": "~5.0",
        "sensio/framework-extra-bundle": "^3.0.2",
        "incenteev/composer-parameter-handler": "~2.0",
        "friendsofsymfony/user-bundle": "2.0.*@dev",
        "pugx/multi-user-bundle": "3.0.*@dev"
    },
    "require-dev": {
        "sensio/generator-bundle": "~3.0",
        "symfony/phpunit-bridge": "~2.7"
    },
    "scripts": {
        "symfony-scripts": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ],
        "post-install-cmd": [
            "@symfony-scripts"
        ],
        "post-update-cmd": [
            "@symfony-scripts"
        ]
    },
    "config": {
        "bin-dir": "bin",
        "platform": {
            "php": "5.3.9"
        }
    },
    "minimum-stability": "dev",
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "symfony-assets-install": "relative",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "2.8-dev"
        }
    }
}

Note that i'm using Symfony 2.8 version. Does that matter if it's not the newest version?

EDIT 2

i have done this :

# FOS user config
fos_user:
    db_driver: orm
    firewall_name: main
    user_class: Utilisateurs\UtilisateursBundle\Entity\Utilisateurs
    services:
        user_manager: pugx_user_manager
        fos_user.doctrine_registry:
            alias: doctrine

but it doesn't work i get this message when executing in web_dev.php :

Unrecognized option "services" under "fos_user"

Is my services term nicely place?


Solution

  • In PUGX\MultiUserBundle\Resources\config\orm.yml replace "@fos_user.entity_manager" by "@fos_user.object_manager"

    In app\config\config.yml add (or modify)

    services:
        fos_user.doctrine_registry:
            alias: doctrine
    

    It should solve your problem.