Skip to main content
Topic: Models (Read 1064 times) previous topic - next topic

Models

According to the information here:  https://phprad.com/info/api#models  the models are stored in app/models/  but in my case, in there I can only find MysqliDb.php and PDODb.php.

The "models" are inserted at the top of the corresponding Controller in the form of a function plus " $db = $this->GetModel(); " etc.

Before looking at that API documentation i had been checking the code and assumed that the way things are done, injecting the model in the controller was the path that had been chosen, but the I found this text:

"Models are optionally available for those who want to use a more traditional MVC approach."

Let's assume I prefer that way, so.. how is it done with PHPRad ? I was looking at the different configuration files and options and couldn't figure.

Thanks


 

Re: Models

Reply #1
Please the API documentation is now stale. We are currently working our complete system documentation which will explain PHPRad MVC framework design.

But you can take a look at the BaseCOntroller.php to see how the model is being initialized from the PDODB.php model class.

The MysqliDb.php and PDODB.php are there so that people who intend to use direct mysqli can use it. It has the same functions and implementation of the PDODB. practically this means that you can switch to the MYSQLI version and you code will still work.

Thanks for your great support EwwGee.