J3 Issue No Code Attached Yet
avatar Flowman
13 Oct 2017

Steps to reproduce the issue

If you create a component with multiple categories for example:

	$vName == 'categories'
	$vName == 'categories'

When Joomla\CMS\Table\Category::_getAssetParentId tries to find the parent asset it will fail as there is no com_helloworld.cat1 asset in the assets table. It should instead try to find the component asset com_helloworld.

Expected result

It should get the default ACL from the component asset.

Actual result

It get is ACL from the root asset.

System information (as much as possible)

Joomla 3.8.1
PHP 7.1.1
MySQL 5,7

Additional comments

This could easily be fixed by exploding $this->extension and only use the first part in

->where($this->_db->quoteName('name') . ' = ' . $this->_db->quote($this->extension));

avatar Flowman Flowman - open - 13 Oct 2017
avatar joomla-cms-bot joomla-cms-bot - change - 13 Oct 2017
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 13 Oct 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 13 Oct 2017
Category ACL com_categories
avatar joomla-cms-bot joomla-cms-bot - edited - 13 Oct 2017
avatar brianteeman
brianteeman - comment - 16 Oct 2017

In your asset table do the two categories have a parent id?

avatar franz-wohlkoenig franz-wohlkoenig - change - 16 Oct 2017
Status New Information Required
avatar Flowman
Flowman - comment - 17 Oct 2017

They get the parent id of 1, so the root asset object.

avatar brianteeman
brianteeman - comment - 17 Oct 2017

So thats the problem - you need to give them the parent id of the component. See the assets for com_content for an example

avatar Flowman
Flowman - comment - 17 Oct 2017

Every time you save it, it reset to the root asset as it cannot find the component as the parent.

You need to understand its not like the com_content as com_content does not use two categories in one component.

Check the code in Joomla\CMS\Table\Category::_getAssetParentId and you will understand the problem.

As there is no com_helloworld.cat2 in the asset table it will always fallback to the root asset.

Even com_fields have fixed this

protected function _getAssetParentId(JTable $table = null, $id = null)

avatar franz-wohlkoenig franz-wohlkoenig - change - 22 Oct 2017
Status Information Required Discussion
avatar brianteeman brianteeman - change - 25 Mar 2018
Labels Added: J3 Issue
avatar brianteeman brianteeman - labeled - 25 Mar 2018

Add a Comment

Login with GitHub to post a comment