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

Bugfix | Fixed bundle controllers to not depend on container if possible #1689

Merged
merged 2 commits into from
Jul 26, 2021

Conversation

stloyd
Copy link
Collaborator

@stloyd stloyd commented Jan 15, 2021

This PR changes:

  • removed dependency on AbstractController in LoginController,
  • replaced dependency on parameters in ConnectController in favor of injecting them into __construct()

@XWB
Copy link
Member

XWB commented Jan 15, 2021

Not sure about this, Symfony advises that bundles should not rely on autoconfigure / autowire.

@stloyd stloyd force-pushed the bugfix/adjust-controller-config branch 2 times, most recently from db35319 to a4b1f49 Compare January 15, 2021 16:42
@stloyd stloyd changed the title Bugfix | Force autowire & autoconfiguration on bundle controllers Bugfix | Fixed bundle controllers to not depend on container if possible Jan 15, 2021
@stloyd stloyd requested a review from XWB January 16, 2021 13:22
@Seldaek
Copy link
Contributor

Seldaek commented Jan 17, 2021

It does not seem to fix my issue @stloyd:

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException:
The "HWI\Bundle\OAuthBundle\Controller\ConnectController::getParameter()" method is missing a parameter bag to work properly. Did you forget to register your controller as a service subscriber? This can be fixed either by using autoconfiguration or by manually wiring a "parameter_bag" in the service locator passed to the controller.

  at vendor/symfony/framework-bundle/Controller/AbstractController.php:68
  at Symfony\Bundle\FrameworkBundle\Controller\AbstractController->getParameter()
     (vendor/hwi/oauth-bundle/Controller/ConnectController.php:157)
  at HWI\Bundle\OAuthBundle\Controller\ConnectController->connectServiceAction()
     (vendor/symfony/http-kernel/HttpKernel.php:158)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:80)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:201)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (web/app.php:35)                

@ksom
Copy link

ksom commented Feb 15, 2021

@XWB This commit doesn't use autowire or autoconfigure. It adds some explicit dependencies in the service configuration.
To me, it's the way to go.

@Seldaek Yes it's normal, because your issue is located in the ConnectController and this commit concerns the LoginController.

Please merge this, it doesn't solve every issues but it's a step forward.

@stloyd stloyd force-pushed the bugfix/adjust-controller-config branch from a4b1f49 to 3867d03 Compare July 7, 2021 10:53
@stloyd stloyd added this to the 1.4 milestone Jul 7, 2021
@stloyd stloyd linked an issue Jul 7, 2021 that may be closed by this pull request
Controller/ConnectController.php Show resolved Hide resolved
Resources/config/controller.xml Outdated Show resolved Hide resolved
@stloyd stloyd force-pushed the bugfix/adjust-controller-config branch from 3867d03 to 58a9527 Compare July 26, 2021 10:23
@stloyd stloyd force-pushed the bugfix/adjust-controller-config branch from 58a9527 to 10f55dd Compare July 26, 2021 10:25
@stloyd stloyd mentioned this pull request Jul 26, 2021
@stloyd stloyd merged commit e76e830 into hwi:master Jul 26, 2021
@stloyd stloyd deleted the bugfix/adjust-controller-config branch July 26, 2021 14:39
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

Successfully merging this pull request may close these issues.

ServiceNotFoundException: missing a parameter bag to work properly
5 participants