PR-4.4-dev Pending

User tests: Successful: Unsuccessful:

avatar CraftException
CraftException
23 Oct 2023

Summary of Changes

I've added to methods to the Joomla\CMS\MVC\View\AbstractView Class:

  • Added $properties to get method. If you want to also provide properties to the model method, you can use other
    parameters after the $properties and $default parameter. Until now, you could only call a method of a model with specific properties by accessing the model diretly:
    $this->getModel("Article")->getById($id)
    But now you can just use the get method:
    $this->get("ById", "Article", $id)
  • Added new method getAll as a shorthand to get all Data of a Model. Until now, you could also only call a method to display all data via the model directly:
    $this->getModel("Article")->getArticles()
    Now you can just use the getAll method:
    $this->getAll("Article") -> $this->get("Articles, "Article") If you have a specific list function (e.g. getAllArticles), you can also provide a second parameter $property, otherwise the model name will automatically be transformed into a plural noun. $this->getAll("Article", "Fields")->$this->get("Fields", "Article")`

Testing Instructions

s. above.

Actual result BEFORE applying this Pull Request

Accessing the model directly in Views needed to call specific methods

Expected result AFTER applying this Pull Request

More convenient methods in AbstractView

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

avatar CraftException CraftException - open - 23 Oct 2023
avatar CraftException CraftException - change - 23 Oct 2023
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 23 Oct 2023
Category Libraries
avatar CraftException CraftException - change - 23 Oct 2023
Title
4.4 dev
Changed to AbstractView.php
avatar CraftException CraftException - edited - 23 Oct 2023
avatar CraftException CraftException - change - 23 Oct 2023
Labels Added: PR-4.4-dev
avatar CraftException CraftException - change - 23 Oct 2023
Title
Changed to AbstractView.php
Changes to AbstractView.php
avatar CraftException CraftException - edited - 23 Oct 2023
avatar rdeutz
rdeutz - comment - 26 Oct 2023

Sorry, this is not the way we want it. As you by yourself noticed you get all the inforamtion with calling the model, your addition doesn't make things easier.

avatar rdeutz rdeutz - change - 26 Oct 2023
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2023-10-26 11:59:32
Closed_By rdeutz
avatar rdeutz rdeutz - close - 26 Oct 2023

Add a Comment

Login with GitHub to post a comment