The most realistic way to this is is by getting the endpoints of the routes.
A controller doesn't have a required structure as the documentation implies. An action method does not need to be suffixed with Action
in the name. The reason it is documented this way is because a lot of people use the catch all configuration in their routing yml, the suffix is needed to guess the endpoints.
When you print out the routes:
print_r($this->container->get('router')->getRouteCollection()->all());
You will see the controller methods used against each route. These routes technically don't 'belong' to any bundle since you can point a route at any method of any class.
However, you can use the list and a bit of string magic to tell the bundle based on the namespace.
Bare in mind that a _controller
like web_profiler.controller.profiler:infoAction
means the method belongs to a service instantiated via dependency injection.