Vebut Posted August 2, 2008 Share Posted August 2, 2008 Hi! I'm currently building an application on my framework (Rapid Development Framework) which is based on a router, main controller and a serie of different classes that helps building my pages. So, my router points the user to a specific application controller class and method within it, decided by the uri. My application controller builds a relation to my main controller by: class Application extends Controller Everything is working perfect without any problems, well - till you add a constructor to the application controller class. The relation between my app controller and the main controller seems to crash (still the application class and method runs without any error-messages), but my controller is out of reach. I call the application controller through call_user_func(), and my first thought is that this function cant handle the relations correctly (?) <?php /** * Run Application * This will launch our controller and point to a given method */ private function runApplication () { return call_user_func(array( $this->controller, $this->method )); } ?> Why is this happing and how can I fix it? Thansk! // Daniel Quote Link to comment https://forums.phpfreaks.com/topic/117828-solved-constructor-makes-class-relation-crash/ Share on other sites More sharing options...
genericnumber1 Posted August 2, 2008 Share Posted August 2, 2008 Probably a seemingly stupid question to you, but some people mess up and do this.. and if you do it's perfectly fine... Are you overwriting a constructor that's in your parent controller class that's required for the controller to function? I always use a seperate method in my controllers that is called immediately after the class is constructed. I do this mainly because I use the constructor in the parent controller classes, which is why I bring up the issue. Quote Link to comment https://forums.phpfreaks.com/topic/117828-solved-constructor-makes-class-relation-crash/#findComment-606207 Share on other sites More sharing options...
Vebut Posted August 2, 2008 Author Share Posted August 2, 2008 Ohhhhhh, I'm really stupid... The main controller constructor has to be called throught the app controller as it's not automatically constructed when the child has a constructor of its own. I guess I could blame all these hours of coding today Thanks! // Daniel Quote Link to comment https://forums.phpfreaks.com/topic/117828-solved-constructor-makes-class-relation-crash/#findComment-606260 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.