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:
Once decision image, we will need to implement the change in component dispatcher to support this naming convention
Labels |
Added:
?
|
Category | ⇒ | Code style |
Status | New | ⇒ | Discussion |
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
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?
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
@joomdonation is this still an open issue. The last comment suggests you were going to come back with an answer to @mbabker question
Sorry, I forgot to close this one. Closing it now.
Status | Discussion | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-12-25 14:58:53 |
Closed_By | ⇒ | joomdonation |
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 view
s not controller
s.
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?
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.