User tests: Successful: Unsuccessful:
Models, Views and Tables should not being created in the Controller or models itself. Instead of a factory should do the job.
This PR adds a new Mvc factory where we can pass that into a controller or model where the can create their objects trough. Like that we are one step closer to a DI set up.
This should simplify the work of @joomdonation in #14809, #14810 and #14721.
Browse the back end.
No error.
No error.
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Labels |
Added:
?
|
Let's fix conflicts here. I think we probably do want to end up moving controller creation into the MVC factory too. but this is a good starting point.
@joomdonation is taking over the namespacing part so I'm out.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-04-07 07:24:37 |
Closed_By | ⇒ | laoneo |
Status | Closed | ⇒ | New |
Closed_Date | 2017-04-07 07:24:37 | ⇒ | |
Closed_By | laoneo | ⇒ |
Status | New | ⇒ | Pending |
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-04-07 14:02:32 |
Closed_By | ⇒ | wilsonge | |
Labels |
Added:
?
Removed: ? |
I just looked at this implementation. With my limited architecture skill / experience, I could say it is right or wrong. However, I do have some questions below:
Assume you pass $factory as the fourth parameter, $factory keep an instance of application, and we also has $app as parameter of controller parameter, so basically, there are 2 apps object passed to controller constructor, seems it doesn't right.
Look at createModel method
public function createModel($name, $prefix = '', array $config = array())
Can $prefix really be an optional parameter? I think the only parameter should be optional is $config. If someone calls this method without proper $prefix parameter, it won't work as expected (the system could never create a model with only $name parameter)
In current legacy controller class, $prefix is marked as optional parameter because it is a protected method. The only way to actual get model in controller is via getModel method and that method does calculates default $prefix if needed before calling createModel method.
The same question is applied for createView, createTable methods.