Back to AssociationExtensionHelper class

Method getAssociationList

public array
getAssociationList
(mixed $typeName, mixed $itemId)
Get the associated items for an item
Parameters
  • string $typeName The item type
  • int $itemId The id of item for which we need the associated items
Returns
  • array
Since
  • 3.7.0

Method getAssociationList - Source code

/**
 * Get the associated items for an item
 *
 * @param   string  $typeName  The item type
 * @param   int     $itemId    The id of item for which we need the associated items
 *
 * @return   array
 *
 * @since   3.7.0
 */
public function getAssociationList($typeName, $itemId)
{
    $items = array();
    $associations = $this->getAssociations($typeName, $itemId);
    foreach ($associations as $key => $association) {
        $items[$key] = ArrayHelper::fromObject($this->getItem($typeName, (int) $association->id), false);
    }
    return $items;
}