I have a problem with AbstractController in my Reusable Bundles.
Without it work AbstractController it works.
class MyCustomController
{
public function sayHello(){
return new Response('Hello');
}
}
With AbstractController it doesn't work:
class MyCustomController extends AbstractController
{
public function sayHello(){
return new Response('Hello');
}
}
I have an error:
reusable_tools.controller.my_custom_controller" has no container set, did you forget to define it as a service subscriber?
The controller is declared as:
<service id="reusable_tools.controller.my_custom_controller" class="Reusable\ToolsBundle\Controller\MyCustomController" public="true"/>
<service id="Reusable\ToolsBundle\Controller\MyCustomController" alias="reusable_tools.controller.my_custom_controller"/>
routes.xml:
<route id="reusable_tools_controller_my_custom_controller" controller="reusable_tools.controller.my_custom_controller:sayHello" path="/" />
debug:container:
Reusable\ToolsBundle\Controller\MyCustomController alias for "reusable_tools.controller.my_custom_controller"
Any ideas?
Configuration : Symfony 5.2.6 (Full) PHP 8.0.3
Struggling into the same issue. The issue is that
For now I've decided to add the following lines to my application
config/services.yml
;Didn't manage to add this to services in my bundle, so for now just adding some instructions to my
README.md
.For now this solution works fine.