? Failure

User tests: Successful: Unsuccessful:

avatar mvanvu
mvanvu
16 Sep 2015

Bugs: preg_match('/(.*)Controller/i', 'MycomponentControllerMyname', $r);
$this->name = strtolower($r[2]); // mycomponent (instead of myname)

avatar mvanvu mvanvu - open - 16 Sep 2015
avatar mvanvu mvanvu - change - 16 Sep 2015
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 16 Sep 2015
Labels Added: ?
avatar joomdonation
joomdonation - comment - 16 Sep 2015

Be careful with this change. While the method name is getName(), it is actually doesn't return name of the controller.

It is used to actually get the name of the component, which then be used as default name of model, default name of view in case there is no data passed to getModel(), getView() method. It is also used for Model class suffix, View class suffix.....

So If we make this change, I am afraid of it will break existing extensions. So although the name of method sound like incorrect, I think we will have to leave it as how it is for now.

avatar rdeutz
rdeutz - comment - 16 Sep 2015

@mvanvu please give a description what is the bug you are think you have found and provide testing instruction. I personal think from the code review that this is a B/C break and not a bug you are fixing.

avatar mvanvu
mvanvu - comment - 16 Sep 2015

@rdeutz If you have a controller has extended on JControllerAdmin and you do not provide a method getModel() then you will get some bugs during execute some task such as publish, ubpublish...

P/s: Sometime we have to create a dynamic controller and we will want to auto detect the name.

avatar rdeutz rdeutz - close - 16 Sep 2015
avatar rdeutz
rdeutz - comment - 16 Sep 2015

So then the solution is to create a getModel Method and not to change the behaviour of the JController.

A good sign that you are making something wrong is when unit tests fail.

Closing it because it isn't a bug

avatar rdeutz rdeutz - change - 16 Sep 2015
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2015-09-16 10:42:17
Closed_By rdeutz

Add a Comment

Login with GitHub to post a comment