Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Private services in Symfony 4 #24

Open
damejeras opened this issue Apr 14, 2020 · 2 comments
Open

Private services in Symfony 4 #24

damejeras opened this issue Apr 14, 2020 · 2 comments

Comments

@damejeras
Copy link

I think that bundle does not register properly with Symfony 4.4. I am getting this error when JS submits recaptcha response to /gentle-force/recaptcha/unlock. The controller for URI "/gentle-force/recaptcha/unlock" is not callable. Controller "maba_gentle_force.recaptcha.controller" cannot be fetched from the container because it is private. Did you forget to tag the service with "controller.service_arguments"?.

As a workaround I have copied controller's code and made my own controller. Also I am using custom recaptcha template.

@damejeras damejeras changed the title Symfony 4 is not supported Private services in Symfony 4 Apr 14, 2020
@mehdibo
Copy link

mehdibo commented May 22, 2020

I'm having the same issue

@shahariaazam
Copy link

Until this library fix this, those services can be made public by Compiler Pass from your application without touching the library.

class AppKernel extends Kernel implements CompilerPassInterface
{

    // . . . . . . .
    // . . . . . . .

    public function process(ContainerBuilder $container)
    {
        $serviceIds = [
            'maba_gentle_force.recaptcha.controller',
        ];

        foreach ($serviceIds as $serviceId) {
            $container->getDefinition($serviceId)
                ->setPublic(true)
            ;
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants