What about calling method of a class from a route?

Hi!
in the documentation exists the possibility of calling a method of a controller class by using

\Controller::class.":method"

convention. Apparently this is not any longer possible as the new documentation is referring to a Action controller with a single method __invoke…

is that right? if so, why???

Hi!

No, actually you still can declare a route handler using all possibilities available in v3.
I think the docs are just taking the invokable class approach as standard for the explanations.
Also, many projects are using the single action pattern instead of controllers, like the new Skeleton itself.

I tried but eventually the framework Wal trying to invoke a “get” method instead of the specified method, fo example

\ClassA::class . ‘:echo’

Will return an error that “get” was not found In class ClassA…

That is why I am asking

This’ strange, I just tried to check this in a clean Slim project and just worked fine, your project may have some behavior that is changing the way Slim resolves the route declaration. I’d suggest you to debug your code, you can place some breakpoints in Slim’s request handler (Slim class) and callable resolver (Slim\CallableResolver), this would help.

Also, could you try to simulate this behavior in a fresh installation of Slim?