? ? Success

User tests: Successful: Unsuccessful:

avatar izharaazmi
izharaazmi
12 May 2016

Pull Request for Issue #10416.

Summary of Changes

Use getState instead of direct property read in JModelList to avoid any undefined property warnings.
Using $this->getState against $this->state->get ensures the model state is populated appropriately.

Testing Instructions

  • Enable error reporting from global configuration.
  • In any list view class such as ContentViewArticles at administrator/components/com_content/views/articles/view.html.php in the display method call $this->get('FilterForm'); before $this->get('State') or $this->get('Items') etc.

Expected: Everything should work correctly.
Actual: You see 4 php notices such as Notice: Undefined property: JObject::$list....

Fixes #10416

avatar izharaazmi izharaazmi - open - 12 May 2016
avatar izharaazmi izharaazmi - change - 12 May 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 12 May 2016
Labels Added: ?
avatar izharaazmi izharaazmi - change - 12 May 2016
The description was changed
avatar brianteeman brianteeman - change - 12 May 2016
Category Libraries
avatar andrepereiradasilva
andrepereiradasilva - comment - 12 May 2016

@izharaazmi you have unit test errors.

avatar izharaazmi
izharaazmi - comment - 12 May 2016

@andrepereiradasilva yeah, I'm looking at that. Apparently that is the issue with the test definition. But can't say it yet.

avatar joomla-cms-bot joomla-cms-bot - change - 12 May 2016
Labels Added: ?
avatar andrepereiradasilva
andrepereiradasilva - comment - 12 May 2016

@Devportobello you have to mark as tested in the issue tracker (https://issues.joomla.org/tracker/joomla-cms/10435 login with github and mark test as success).

avatar andrepereiradasilva andrepereiradasilva - test_item - 12 May 2016 - Tested successfully
avatar andrepereiradasilva
andrepereiradasilva - comment - 12 May 2016

I have tested this item :white_check_mark: successfully on 45a6d09

The notices dissapear after this PR so i will make as success.
I think if you used $this->state->get('list.xxxx') you would get the same result.

But for what is worth, if you exchange the order the filters/ordering/search (aka searchtols) will not work properly. With or without this PR.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10435.

avatar Devportobello Devportobello - test_item - 12 May 2016 - Tested successfully
avatar Devportobello
Devportobello - comment - 12 May 2016

I have tested this item :white_check_mark: successfully on 45a6d09


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10435.

avatar brianteeman brianteeman - change - 12 May 2016
Status Pending Ready to Commit
Labels
avatar brianteeman
brianteeman - comment - 12 May 2016

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10435.

avatar joomla-cms-bot joomla-cms-bot - change - 12 May 2016
Labels Added: ?
avatar brianteeman brianteeman - change - 12 May 2016
Milestone Added:
avatar izharaazmi
izharaazmi - comment - 12 May 2016

But for what is worth, if you exchange the order the filters/ordering/search (aka searchtols) will not work properly. With or without this PR.

@andrepereiradasilva Can you please explain this.

avatar andrepereiradasilva
andrepereiradasilva - comment - 12 May 2016

Note this happens with or without your PR.

For instance, change the order of the $this->get('FilterForm') in the articles view.html.php file.

$this->filterForm    = $this->get('FilterForm'); // PUT THIS ONE ON TOP
$this->items         = $this->get('Items');
$this->pagination    = $this->get('Pagination');
$this->state         = $this->get('State');
$this->authors       = $this->get('Authors');
$this->activeFilters = $this->get('ActiveFilters');

Now try to use the searchtools in articles view. search for something, order or filter by something.
You will notice the table will be modified accordly but the searchtools filters pre selected values won't.

avatar izharaazmi
izharaazmi - comment - 13 May 2016

@andrepereiradasilva The solution is straightforward. Use $this->get('State') in the view before you call any method on the model.
OR
Change the JModelList::loadFormData() to call $this->getState(); before calling $app->getUserSate()

But that is not all. Therefore instead of a placing a PR, I'd prefer a little discussion regarding loadFormData behavior in JModelList vs JModelForm, preferably on a separate thread.

avatar andrepereiradasilva
andrepereiradasilva - comment - 13 May 2016

ok then create a issue / RFC

avatar roland-d roland-d - change - 16 May 2016
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2016-05-16 21:58:30
Closed_By roland-d
avatar roland-d
roland-d - comment - 16 May 2016

Thanks everybody

avatar joomla-cms-bot joomla-cms-bot - change - 16 May 2016
Labels Removed: ?

Add a Comment

Login with GitHub to post a comment