If you create a component with multiple categories for example:
JHtmlSidebar::addEntry( JText::_('COM_HELLOWORLD_CAT1'), 'index.php?option=com_categories&extension=com_helloworld.cat1', $vName == 'categories' ); JHtmlSidebar::addEntry( JText::_('COM_HELLOWORLD_CAT2'), 'index.php?option=com_categories&extension=com_helloworld.cat2', $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.
It should get the default ACL from the component asset.
It get is ACL from the root asset.
This could easily be fixed by exploding $this->extension and only use the first part in
No Code Attached Yet
So thats the problem - you need to give them the parent id of the component. See the assets for com_content for an example
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