You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Catchable Fatal Error: Argument 1 passed to MedAppBundle\Form\ProfileType::__construct() must be an instance of Application\Liip\ThemeBundle\Services\ThemeChanger, string given, called in E:\svn\medapp\vendor\pugx\multi-user-bundle\PUGX\MultiUserBundle\Model\UserDiscriminator.php on line 155and defined
because my ProfilyType form defined as a service needs an object in its constructor
This is currently not covered.
You can override pugx_user.manager.user_discriminator service writing a compiler pass, then extend our UserDiscriminator and override getFormType method. You'll likely need also to override constructor to inject your form service.
Uh, that was what I was trying to avoid. Hopefully it will be supported in the future, often forms are used as services.
The constructor needs to inject any form's own services, I can't really hardcode it, though. Even thought the discriminator is used only for register/profile forms.
In the meantime, I've just changed the way I create the form in the controller: $form = $this->get('form.factory')->create($this->get('app_user_profile_type')); where app_user_profile_type is the form service.
Everything works fine if the forms are not defined as services and need something in their constructors. However, in my ProfileController:
calls
which calls
This works for normal forms, but not for service forms. It tries to call
in my case, which turns into the error
because my ProfilyType form defined as a service needs an object in its constructor
Is this a not covered feature of this bundle or am I doing something wrong?
The text was updated successfully, but these errors were encountered: