panique / mini2

Just an extremely simple naked PHP application, useful for small projects and quick prototypes.
MIT License
417 stars 102 forks source link

[check] Possible issue in loadModel() #29

Closed angrylinuxuser closed 10 years ago

angrylinuxuser commented 10 years ago

So im a total nub when it comes to php and mvc so i might be totaly wrong here. Basicly i was trying to create a private function in my controler to do some basic checks and use it within other methods. While invoking this private method i came across error "Fatal error: Cannot redeclare class ....". After some googling i managed to fix this by changing "require" to "require_once" in loadModel method in libs/application.php (line 48). If this isnt an issie then sorry to bother You. if it is then You could check libs/controller.php for any possible similar errors.

VeeeneX commented 10 years ago

Can you provide Your code, because I think that the problem is on Your side. This basically happens, when You are trying to load the model which is already loaded. BTW: using php-mvc-advanced in production, is not really good for it's architecture.

angrylinuxuser commented 10 years ago

I dont have current version of my code where i am but now i see what i was doing wrong. I was loading a model in a private method and in the public index method again. Well those are the perks of beeing a nub:) Now Im passing model as the argument to the private method and now it works:) Sorry for the mess. And im using php-mvc-advanced as a way to brush up my very rusty php and learn twig and get some sens of how MVC works. Its just a small private project for personal use. So discard this Issue since its all me.