Documentation

TaxonomyReaderService
in package

Class responsible for retrieving and managing taxonomy-related data, such as elements, labels, parent-child relationships, and dimensions. Interacts with a MySQL database to perform queries and return structured results.

Table of Contents

Constants

DEFAULT_LABEL_ROLE  = 'standard'

Properties

$mySql  : MySql

Methods

__construct()  : void
Constructor for the class.
getChildren()  : array<string|int, mixed>
Retrieves the child elements of a specified parent taxonomy element, including their metadata and associated labels (if available). Results are ordered by sort order and child element ID.
getDefaultMemberForDimension()  : array<string|int, mixed>|null
Retrieves the default member for a given taxonomy dimension based on the specified language.
getDimensionMembers()  : array<string|int, mixed>
Retrieves a list of dimension members for a specified taxonomy dimension, including their associated element details and labels. The results are sorted by label and element name.
getDimensionsForPrimaryItem()  : array<string|int, mixed>
Retrieves the dimensions associated with a primary taxonomy item, along with their relevant metadata and labels, if available in the specified language.
getElementById()  : array<string|int, mixed>|null
Retrieves an element by its ID from the taxonomy_element table.
getParents()  : array<string|int, mixed>
Retrieves the parent elements of a given taxonomy child element along with additional metadata such as element attributes and associated labels in the specified language.
getPreferredLabel()  : array<string|int, mixed>|null
Retrieves the preferred label for a taxonomy element based on the specified language and role preference. If no matching label is found, a fallback mechanism is applied to select a label based on predefined role order.
getRootPresentationNodes()  : array<string|int, mixed>
Retrieves the root presentation nodes, which are taxonomy elements that do not have any parent presentation relationships, along with their associated labels in the specified language.
cleanDisplayLabel()  : string
Cleans and formats a display label by removing unnecessary whitespace and specific trailing taxonomy suffixes (e.g., '[abstract]', '[line items]', '[table]').

Constants

Properties

Methods

getChildren()

Retrieves the child elements of a specified parent taxonomy element, including their metadata and associated labels (if available). Results are ordered by sort order and child element ID.

public getChildren(int $parentElementId[, string $lang = 'en' ]) : array<string|int, mixed>
Parameters
$parentElementId : int

The identifier of the parent taxonomy element for which children are being retrieved.

$lang : string = 'en'

The language code to use when fetching labels for child elements. Defaults to 'en'.

Return values
array<string|int, mixed>

Returns an array of associative arrays containing child element metadata and label information. An empty array is returned if no children are found.

getDefaultMemberForDimension()

Retrieves the default member for a given taxonomy dimension based on the specified language.

public getDefaultMemberForDimension(int $taxonomyDimensionId[, string $lang = 'en' ]) : array<string|int, mixed>|null

If a standard label for the member exists in the specified language, it is included in the result.

Parameters
$taxonomyDimensionId : int

The identifier of the taxonomy dimension for which the default member is being retrieved.

$lang : string = 'en'

The language code to use when searching for the label of the default member. Defaults to 'en'.

Return values
array<string|int, mixed>|null

Returns an associative array containing the default member information if found, or null if no default member exists for the given dimension.

getDimensionMembers()

Retrieves a list of dimension members for a specified taxonomy dimension, including their associated element details and labels. The results are sorted by label and element name.

public getDimensionMembers(int $taxonomyDimensionId[, string $lang = 'en' ]) : array<string|int, mixed>
Parameters
$taxonomyDimensionId : int

The identifier of the taxonomy dimension for which members are being retrieved.

$lang : string = 'en'

The language code to use when fetching labels. Defaults to 'en'.

Return values
array<string|int, mixed>

Returns an array of associative arrays, where each entry contains details about a dimension member, such as its element ID, element name, namespace, and label. If no members are found, an empty array is returned.

getDimensionsForPrimaryItem()

Retrieves the dimensions associated with a primary taxonomy item, along with their relevant metadata and labels, if available in the specified language.

public getDimensionsForPrimaryItem(int $primaryElementId[, string $lang = 'en' ]) : array<string|int, mixed>
Parameters
$primaryElementId : int

The identifier of the primary taxonomy element for which the dimensions are being retrieved.

$lang : string = 'en'

The language code to use when retrieving dimension labels. Defaults to 'en'.

Return values
array<string|int, mixed>

An array of associative arrays representing the dimensions, including their metadata and labels.

getElementById()

Retrieves an element by its ID from the taxonomy_element table.

public getElementById(int $elementId) : array<string|int, mixed>|null
Parameters
$elementId : int

The ID of the element to retrieve.

Return values
array<string|int, mixed>|null

An associative array containing the element data if found, or null if no element is found.

getParents()

Retrieves the parent elements of a given taxonomy child element along with additional metadata such as element attributes and associated labels in the specified language.

public getParents(int $childElementId[, string $lang = 'en' ]) : array<string|int, mixed>
Parameters
$childElementId : int

The identifier of the taxonomy child element whose parents are being retrieved.

$lang : string = 'en'

The language code to use when fetching labels for the parent elements. Defaults to 'en'.

Return values
array<string|int, mixed>

Returns an array of associative arrays, where each associative array contains information about a parent element and its associated metadata. If no parents are found, an empty array is returned.

getPreferredLabel()

Retrieves the preferred label for a taxonomy element based on the specified language and role preference. If no matching label is found, a fallback mechanism is applied to select a label based on predefined role order.

public getPreferredLabel(int $elementId[, string $lang = 'en' ][, array<string|int, mixed> $rolePreference = ['standard', 'total', 'net', 'documentation', 'guidance'] ]) : array<string|int, mixed>|null
Parameters
$elementId : int

The identifier of the taxonomy element for which the label is being retrieved.

$lang : string = 'en'

The language code to use when searching for the label. Defaults to 'en'.

$rolePreference : array<string|int, mixed> = ['standard', 'total', 'net', 'documentation', 'guidance']

An ordered list of roles to prioritize when selecting the label. Defaults to ['standard', 'total', 'net', 'documentation', 'guidance'].

Return values
array<string|int, mixed>|null

Returns an associative array containing the label information if found, or null if no label matches the criteria.

getRootPresentationNodes()

Retrieves the root presentation nodes, which are taxonomy elements that do not have any parent presentation relationships, along with their associated labels in the specified language.

public getRootPresentationNodes([string $lang = 'en' ]) : array<string|int, mixed>
Parameters
$lang : string = 'en'

The language code used to fetch labels for the taxonomy elements. Defaults to 'en'.

Return values
array<string|int, mixed>

Returns an array of associative arrays, where each associative array represents a root presentation node with its details and label information.

cleanDisplayLabel()

Cleans and formats a display label by removing unnecessary whitespace and specific trailing taxonomy suffixes (e.g., '[abstract]', '[line items]', '[table]').

private cleanDisplayLabel(string $label) : string
Parameters
$label : string

The original label to be cleaned and processed.

Return values
string

The cleaned and formatted label with undesired suffixes removed.


        
On this page

Search results