Im currently developing an MVC application platform, and I came up with some tips on how I should build my model layers.
The model is built so that each model is mapped to a table in the database for these applications, so a typical application will have
- Configuration
- Themes
- Forums
and each will appear where the PHP file is specified, such as app/models/configuration.php
Now the problem is creating the parent class of the database to process certain table data, for example:
class PDOModel
{
public function __construct()
{
$this->__Communicator = Registry::getPDOInstance();
}
public function getSingle($id)
{
return ;
}
}
And something like this for
class Model_Topic extends PDOModel
{
protected $__id_column = 'id';
}
and then in my controller I can use like this:
$Topic = $this->model->topic->get(22);
But I would also like to take into account also the automatic join of tables, are there any simple lightweight libraries that have been tested and meet my requirements.
.