?
avatar joomdonation
joomdonation
2 Apr 2017

Our legacy MVC allows creating separate controller class for each format (raw, json...) like in this class https://github.com/joomla/joomla-cms/blob/staging/components/com_users/controllers/profile.json.php

We need to decide how we want handle it in in namespace MVC for Joomla 4.. Some possible class names:

  • Joomla\Component\Content\Site\Controller\Json\Profile
  • Joomla\Component\Content\Site\Controller\JsonProfile
  • Joomla\Component\Content\Site\Controller\ProfileJson

Once decision image, we will need to implement the change in component dispatcher to support this naming convention

avatar joomdonation joomdonation - open - 2 Apr 2017
avatar joomla-cms-bot joomla-cms-bot - change - 2 Apr 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 2 Apr 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 2 Apr 2017
Category Code style
avatar franz-wohlkoenig franz-wohlkoenig - change - 2 Apr 2017
Status New Discussion
avatar mbabker
mbabker - comment - 2 Apr 2017

What is the need for separate controller classes based on the request format? The only classes that should have an architectural need for variants based on request format should be views.

avatar joomdonation
joomdonation - comment - 2 Apr 2017

I don't really know as I haven't checked the code carefully yet. Saw it in legacy MVC and in the code of com_users as the link I posted above

avatar mbabker
mbabker - comment - 2 Apr 2017

I know the code is doing it now, what I'm basically asking is why do we need to carry that behavior forward? Is this a behavior we can deprecate?

avatar joomdonation
joomdonation - comment - 2 Apr 2017

To have the answer, I will have to look at the current code/ function to see whether we need it in namespace controller. As I said, I haven't looked at that part of code carefully yet. Will update here once I looked at it and understand the purpose of the current code

avatar joomdonation
joomdonation - comment - 2 Apr 2017

While you are here, could you please take a look at the other question #15041 ?

avatar brianteeman
brianteeman - comment - 25 Dec 2017

@joomdonation is this still an open issue. The last comment suggests you were going to come back with an answer to @mbabker question

avatar joomdonation
joomdonation - comment - 25 Dec 2017

Sorry, I forgot to close this one. Closing it now.

avatar joomdonation joomdonation - change - 25 Dec 2017
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2017-12-25 14:58:53
Closed_By joomdonation
avatar joomdonation joomdonation - close - 25 Dec 2017
avatar izharaazmi
izharaazmi - comment - 13 Jan 2018

I agree with @mbabker here. Supporting this behaviour encourages people to do something like this: https://groups.google.com/d/msg/joomla-dev-cms/WsC0nA9Fixo/Ur-gPqpqh-EJ. This is also referenced in com_ajax as the best way for JSON output.

Though they can do the same with a normal controller class but at least we should not encourage this. The output should be the job of views not controllers.

Though I should not be commenting on a closed issue, this is what I needed to add. May be we should start a new thread?

Add a Comment

Login with GitHub to post a comment