Joomla\CMS\Categories\Categories::getInstance() has been deprecated with 4.0 and will be removed with 6.0.
The suggested alternative is to use the ComponentInterface.
Factory::getApplication()->bootComponent($component)->getCategory($options, $section);
There is a difference though: getInstance() caches the category service instance. When you query Categories::getInstance($extension, $options)::get() twice for the same category, you'll get the same CategoryNode, without querying the database twice.
Joomla\CMS\Categories\CategoryServiceTrait::getCategory() creates a new categories service on each call and by that you'll not benefit from the nodes cache.
Is it possible to add an instance cache to the Joomla\CMS\Categories\CategoryServiceTrait?
| Labels |
Added:
No Code Attached Yet
|
||
| Labels |
Added:
Feature
|
||