Understanding ControllerModel in the Barebone Framework:
The Barebone framework offers a convenient feature called ControllerModel. It
simplifies the way controllers work with their associated data models by automatically creating a model class with the same name as the
controller.
Imagine:
blogController.blogModel class for you.Benefits:
$this-> notation. For example, $this->model->getPost($id) would call the
getPost function in the blogModel to retrieve a blog post.Location:
blogModel class typically resides in a separate folder named
models within the controller directory. In your example, this would be
applications/frontend/controllers/models/blogModel.php.Optionality:
ControllerModel is not
mandatory. You can still create separate, custom model classes if needed.Example Structure:
applications/
frontend/
controllers/
blogController.php
models/
blogModel.php