? Pending

User tests: Successful: Unsuccessful:

avatar joomdonation
joomdonation
8 Apr 2017

Pull Request for Issue #15041.

Summary of Changes

This is a redo of #15075 because I don't know how to resolve conflicts, sorry. There are some changes in this PR:

  1. Changes default component controller from COM_NAME to a generic controller name as discussed in #15041.
  2. Change code so that namespace stored in namespace column in database doesn't need to have backslash (Joomla\Component\Content instead of Joomla\Component\Content\ ).
  3. Build basic controller config data keys like option and name so that controller class doesn't have to guess these from class name
  4. Add class_exists check to controller class to avoid fatal error
  5. Small update to docblock

Testing Instructions

Code review by Joomla 4 team only.

avatar joomdonation joomdonation - open - 8 Apr 2017
avatar joomdonation joomdonation - change - 8 Apr 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 8 Apr 2017
Category Libraries
avatar joomdonation joomdonation - change - 8 Apr 2017
Title
[4.0] Namespace change default controller to "controller". Redo #15075
[4.0] Change default controller to "controller". Redo #15075
avatar joomdonation joomdonation - edited - 8 Apr 2017
avatar wilsonge wilsonge - change - 12 Apr 2017
Labels Added: ?
avatar wilsonge wilsonge - change - 12 Apr 2017
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-04-12 12:11:07
Closed_By wilsonge
avatar wilsonge wilsonge - close - 12 Apr 2017
avatar wilsonge wilsonge - merge - 12 Apr 2017
avatar wilsonge
wilsonge - comment - 12 Apr 2017

@joomdonation can you edit the com_content namespace files as appropriate for this change please

avatar yvesh
yvesh - comment - 12 Apr 2017

@joomdonation just noticed, shouldn't we use addPsr4 instead of setPsr4? set overrides, add adds :)

avatar wilsonge
wilsonge - comment - 12 Apr 2017

No because otherwise when you create a second dispatcher instance (e.g. in a second module you are going to end up adding the same path multiple times no?

avatar mbabker
mbabker - comment - 12 Apr 2017

Well then we've got a problem. setPsr4 overwrites. addPsr4 calls array_merge(), so that should prevent duplicates?

avatar yvesh
yvesh - comment - 12 Apr 2017

Set overrides, is there any reason we would like to do that?

avatar wilsonge
wilsonge - comment - 12 Apr 2017

Is it a problem to only have a single prefix per component?

avatar mbabker
mbabker - comment - 12 Apr 2017

In theory someone could still manipulate the class loader to put their custom paths before the core paths (same way you can now if you know what you're doing with JControllerLegacy, JModelLegacy, and JTable). So I think we'd want to use the adder over the setter.

avatar joomdonation
joomdonation - comment - 13 Apr 2017

With the reason explains by Michael, I agree that using addPsr4 would be better (at least in theory). When a dispatcher is created a second time for example, yes, the same paths will be added again but it doesn't cost much (just two new elements added to the paths array)

However, with the RFC #15226 by Allon (which looks like I agree), we won't need autoLoad method in dispatcher anymore.

With that said, I will leave it as how it is for now and in case #15226, we will make this change

Add a Comment

Login with GitHub to post a comment