1

Hi i am trying to integrate PUGXMultiUserBundle to my Symfony project I followed the documentation but i have this error When I go on the registration page http://example.com/app_dev.php/register:

Type error: Too few arguments to function Type error: Too few arguments to function FOS\UserBundle\Controller\RegistrationController::__construct(), 0 passed in /Users/Antoine/Desktop/HC/Symfony/var/cache/dev/Container7jg3mzl/getPugxMultiUser_RegistrationManagerService.php on line 8 and exactly 4 expected

with this controller :

public function registerAction()
{   

    return $this->container
                ->get('pugx_multi_user.registration_manager')
                ->register('MultiUtilisateurs\MultiUtilisateursBundle\Entity\UserOne');
}

}

I have no idea why .... Thanks for your help and sorry for the french

Here is my services.yml

userOne.registration.form.type:
    class:     MultiUtilisateurs\MultiUtilisateursBundle\Form\RegistrationUserOneFormType
    arguments: [%fos_user.model.user.class%]
    tags:
        - { name: form.type, alias: multiUtilisateursBundle_userOne }

userTwo.registration.form.type:
    class: MultiUtilisateurs\MultiUtilisateursBundle\Form\RegistrationUserTwoFormType
    arguments: [%fos_user.model.user.class%]
    tags:
        - { name: form.type, alias: multiUtilisateursBundle_userTwo }

and my config.yml

fos_user:
db_driver:     orm                       # Le type de BDD à utiliser, nous utilisons l'ORM Doctrine depuis le début
firewall_name: main                      # Le nom du firewall derrière lequel on utilisera ces utilisateurs
user_class:    MultiUtilisateurs\MultiUtilisateursBundle\Entity\User # La classe de l'entité User que nous utilisons
from_email:
    address: "%mailer_user%"
    sender_name: "%mailer_user%"
service:
    user_manager: pugx_user_manager
registration:
    confirmation:
        enabled: true


pugx_multi_user:
 users:
  user_one:
      entity: 
      class: MultiUtilisateurs\MultiUtilisateursBundle\Entity\UserOne
    registration:
      form: 
        type: MultiUtilisateurs\MultiUtilisateursBundle\Form\Type\RegistrationUserOneFormType
        name: fos_user_registration_form
        validation_groups:  [Registration, Default]
      template: MultiUtilisateursBundle:Registration:user_one.form.html.twig
    profile:
      form:
        type: MultiUtilisateurs\MultiUtilisateursBundle\Form\ProfileUserOneFormType
        name: fos_user_profile_form
        validation_groups:  [Profile, Default] 
user_two:
    entity: 
      class: MultiUtilisateurs\MultiUtilisateursBundle\Entity\UserTwo
    registration:
      form: 
        type: MultiUtilisateurs\MultiUtilisateursBundle\Form\Type\RegistrationUserTwoFormType
        #name: fos_user_registration_form
        validation_groups:  [Registration, Default]
      template: MultiUtilisateursBundle:Registration:user_two.form.html.twig
    profile:
      form: 
        type: MultiUtilisateurs\MultiUtilisateursBundle\Form\Type\ProfileUserTwoFormType
  • The error message indicates the registration controller is not being constructed as a service. I don't use this multi bundle. I suppose you could try checking where the routes are defined. They need a slight tweak to use a [controller as a service](https://symfony.com/doc/current/controller/service.html#referencing-your-service-from-routing). – Cerad Feb 26 '18 at 00:03
  • Hi thanks a lot for your answer i am new with symfony and i didn't understand could you be more specific please – Antoine Salamitou Feb 26 '18 at 11:45
  • Wish I could but I'm simply not familiar with the bundle. If you are working from a tutorial and it say to use $controller->register() then find another tutorial as that is plain wrong. Maybe check on the pugx github site. – Cerad Feb 26 '18 at 13:53
  • I was following the pugxmultibundle documentation but i have the same problem as i am trying to override the fosuserbundle registration controller without using the multi bundle. It seems to be a FOS User Bundle problem... Thanks for your help – Antoine Salamitou Feb 26 '18 at 14:15
  • 1
    I know I am in the minority here but, in my not so humble opinion, FOSUserBundle is something to be avoided at all costs. – Cerad Feb 26 '18 at 14:50
  • ok thx very much – Antoine Salamitou Feb 26 '18 at 14:53

0 Answers0