legacy-knowledge-base
Publicado Jul. 25, 2002

How to relate AssetEntry and AssetCategory

written-by

Jose L. Bango

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

Issue

  • AssetEntryLocalService.getAssetCategoryAssetEntries() does not return any results for a given category.
  • How should I relate AssetCategory and AssetEntry?

Environment

  • DXP 7.1
  • DXP 7.2
  • DXP 7.3

Resolution

  • AssetEntryLocalService.getAssetCategoryAssetEntries() and AssetCategoryLocalServiceUtil.getAssetEntryAssetCategories() (and related methods) were deprecated in 7.1. You should use AssetEntryAssetCategoryRelLocalService instead.
    • Note: While AssetEntryLocalService.getAssetCategoryAssetEntries() does not work at all, AssetCategoryLocalServiceUtil.getAssetEntryAssetCategories() (and related methods) might work. In any case, their use should be avoided.
  • Example:
    long[] assetEntryPKs =
    _assetEntryAssetCategoryRelLocalService.getAssetEntryPrimaryKeys(assetCategoryId);

    for (long assetEntryPK: assetEntryPKs) {
    AssetEntry assetEntry = _assetEntryLocalService.getEntry(assetEntryPK);
    ...
    }

Additional Information

did-this-article-resolve-your-issue

legacy-knowledge-base