Answer the question
In order to leave comments, you need to log in
Why is the current object being returned?
I am learning MVC.
There are two controllers Controller_AJAX and Controller_Blog. Both are derived from Controller. In the action of the first controller I write, $blog = Controller_Blog::getInstance();
but the Controller_AJAX object is returned. At the same time with other controllers everything works fine.
Answer the question
In order to leave comments, you need to log in
What's in the getInstance method? Controller_Blog definitely inherits from Controller?
Perhaps this will help
You have a very strange application architecture. I think it's worth digging towards the singleton ... As an option.
Understood. It turns out that use Singleton was separately registered in Controller_User, and for other classes it was registered in the parent Controller class. Accordingly, getInstance returned the parent class, and the current successor of this class was assigned. I registered use Singleton in all controllers and the problem was solved.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question