-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[5.3] Refactoring views to directly call models (installation & API) #44169
base: 5.3-dev
Are you sure you want to change the base?
Conversation
@@ -41,7 +41,7 @@ class JsonapiView extends BaseApiView | |||
public function displayList(?array $items = null) | |||
{ | |||
try { | |||
$component = ComponentHelper::getComponent($this->get('component_name')); | |||
$component = ComponentHelper::getComponent($this->component_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please define the variable here as "public" or find a better solution?
because component_name
is set by the controller with the LegacyPropertyManagementTrait::set
method, which sets the property dynamic, as alternative a setComponentName()
is needed which sets a protected/private property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, after all this refactoring we still have some cases where set and get are used outside of the HtmlView.php files. To me that is another PR. Quite frankly, in this case I would rather revert this line and do that in another PR as well to not delay merging the rest. Would that be okay?
@@ -43,7 +43,11 @@ class DefaultView extends BaseHtmlView | |||
*/ | |||
public function display($tpl = null) | |||
{ | |||
$this->form = $this->get('Form'); | |||
$model = $this->getModel(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$model = $this->getModel(); | |
$model = $this->getModel(); |
Summary of Changes
This PR refactors the views to get the model object and then directly call the methods of the model instead of going through the
View::get()
indirection. This refactors the views of the Joomla installation and of the web API.Testing Instructions
Everything should work the same.
Link to documentations
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed