User tests: Successful: Unsuccessful:
In one of the last routing PRs, the JApplicationCms and JMenu objects were handed over to the constructor of the component routers. This allows to have test-objects be injected into the routers or to change the original objects where necessary.
This PR implements this change in the core routers by modifying the JComponentRouterBase class and subsequently changing the code in the core routers to use the new objects of the class.
I've been trying to decide if this is backwards compatible for a while longer. Not so much because the core routers are slightly changed, but because JComponentRouterBase is changed in that it gets a constructor and that this constructor accepts 2 parameters. If a developer wrote his own router class which extends from JComponentRouterBase and which has its own constructor, but does not call the parent constructor, $this->app and $this->menu would not be available to the router. But then again, those routers would not use $this->app and $this->menu in their code anyway. The only way this could go wrong, would be if a developer extends a core router and has his own constructor written for it, that does not call the parent constructor. This is a VERY unlikely construct and I would say that this is equally possible to winning the lottery and being struck by lightning at the same time. So I think we are safe here. (I'm just trying to cover all our bases here.)
Testing instructions: Apply the change and simply see that nothing is broken.
This was made possible through the generous donation of the people mentioned in the following link via an Indiegogo campaign: http://joomlager.de/crowdfunding/5-contributors
Labels |
Added:
?
|
Why are we injecting the application object? It's not being used by any of these classes except to get the menu object?
Yes, so far that is true, but I wanted to be proactive and have this available, among other things to have access to the application configuration. Think of it as "Advanced SEF" not per component but globally.
Fair enough
+1 from me. I have a component with router that extends JComponentRouterBase, everything works fine still.
Status | Pending | ⇒ | Ready to Commit |
RTC
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5168.
Status | Ready to Commit | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-11-27 16:29:07 |
thx
@test success Works like a charm