I have two controllers SubmitPerformanceController
and PrintReportController
.
In PrintReportController
I have a method called getPrintReport
.
How to access this method in SubmitPerformanceController
?
I have two controllers SubmitPerformanceController
and PrintReportController
.
In PrintReportController
I have a method called getPrintReport
.
How to access this method in SubmitPerformanceController
?
You shouldn’t. It’s an anti-pattern. If you have a method in one controller that you need to access in another controller, then that’s a sign you need to re-factor.
Consider re-factoring the method out in to a service class, that you can then instantiate in multiple controllers. So if you need to offer print reports for multiple models, you could do something like this: