31 if (!
$source instanceof \DOMDocument) {
36 $types =
$source->getElementsByTagName(
'extension_attributes');
38 foreach ($types as
$type) {
40 $typeName =
$type->getAttribute(
'for');
47 $resourcesElement =
$attribute->getElementsByTagName(
'resources')->item(0);
49 if ($resourcesElement && $resourcesElement->nodeType === XML_ELEMENT_NODE) {
50 $singleResourceElements = $resourcesElement->getElementsByTagName(
'resource');
51 foreach ($singleResourceElements as
$element) {
52 if (
$element->nodeType != XML_ELEMENT_NODE) {
55 $resourceRefs[] =
$element->attributes->getNamedItem(
'ref')->nodeValue;
59 $joinElement =
$attribute->getElementsByTagName(
'join')->item(0);
60 $join = $this->processJoinElement($joinElement,
$attribute);
62 $typeConfig[
$code] = [
63 self::DATA_TYPE => $codeType,
64 self::RESOURCE_PERMISSIONS => $resourceRefs,
65 self::JOIN_DIRECTIVE => $join,
69 $output[$typeName] = $typeConfig;
81 private function processJoinElement($joinElement,
$attribute)
84 if ($joinElement && $joinElement->nodeType === XML_ELEMENT_NODE) {
85 $joinAttributes = $joinElement->attributes;
87 self::JOIN_REFERENCE_TABLE => $joinAttributes->getNamedItem(
'reference_table')->nodeValue,
88 self::JOIN_ON_FIELD => $joinAttributes->getNamedItem(
'join_on_field')->nodeValue,
89 self::JOIN_REFERENCE_FIELD => $joinAttributes->getNamedItem(
'reference_field')->nodeValue,
93 $column = $field->getAttribute(
'column');
95 self::JOIN_FIELD => $field->nodeValue,
96 self::JOIN_FIELD_COLUMN => $column
const RESOURCE_PERMISSIONS
const JOIN_REFERENCE_TABLE
const JOIN_REFERENCE_FIELD