zanbaldwin / eventing

Eventing is a PHP application framework, by Zander Baldwin, based on the HMVC design pattern, licensed under the MIT/X11. This is an unstable, open-source side project.
MIT License
7 stars 0 forks source link

Optimise controller library #25

Closed zanbaldwin closed 13 years ago

zanbaldwin commented 13 years ago

Optimise the controller library - this is the super object. There must be a better way of assigning, storing, etc. modules and models than the method implemented at the moment.

Also, do the variables holding the instances need to be static? What happens when another instance of the controller object is created, eg. when a module is loaded? Should they be loaded the same way as classes?

Should they still be loaded inside the super controller and follow the module@path/to/model identifier pattern (@path/to/model for application models)? But then we have the problem of how does the Load library access, and add models to, the private self::$_models variable without the controller having another method for setting the model, like we have implemented at the moment?

Unless the super controllers model() method is like the following (still not ideal though):

public function model($name, $setModel = false) {
    if($setModel && is_a($setModel, ns(NS, NSLIBRARY) . 'model')) {
        ...
    }
}
zanbaldwin commented 13 years ago

The way to access a model from a controller is $this->model('model_name')->method(); The question is, should we let the framework user access models using $this->_models->model_name->method(); to make the loading of models easier, or make _models private to allow only one way of accessing models?

zanbaldwin commented 13 years ago

::setModel() has been merged into model(), and ::setModule() has been merged into module(). _autoload() method has been completed.